aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-08-28 22:57:38 +0000
committerMatt Kraai <kraai@debian.org>2001-08-28 22:57:38 +0000
commit507891998164b8548f5aebfc54e759a3fbbd3bde (patch)
tree41067b115aeef914e4bacc362bae1ada4bdf8f64
parent28d0ac13d1e8cc798f45ae10cad3d1577b41f736 (diff)
downloadbusybox-507891998164b8548f5aebfc54e759a3fbbd3bde.tar.gz
Use the correct buffer when calling dirname, improve an error message, and
plug some memory leaks. Patch by Laurence Anderson.
-rw-r--r--libbb/unarchive.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libbb/unarchive.c b/libbb/unarchive.c
index 2d171b4ce..4d47eff0e 100644
--- a/libbb/unarchive.c
+++ b/libbb/unarchive.c
@@ -129,7 +129,7 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
if (function & extract_create_leading_dirs) { /* Create leading directories with default umask */
char *buf, *parent;
buf = xstrdup(full_name);
- parent = dirname(full_name);
+ parent = dirname(buf);
if (make_directory (parent, -1, FILEUTILS_RECUR) != 0) {
if ((function & extract_quiet) != extract_quiet) {
error_msg("couldn't create leading directories");
@@ -160,7 +160,7 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
if (stat_res != 0) {
if (mkdir(full_name, file_entry->mode) < 0) {
if ((function & extract_quiet) != extract_quiet) {
- perror_msg("extract_archive: ");
+ perror_msg("extract_archive: %s", full_name);
}
}
}
@@ -266,6 +266,9 @@ char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers
/* seek past the data entry */
seek_sub_file(src_stream, file_entry->size);
}
+ free(file_entry->name); /* may be null, but doesn't matter */
+ free(file_entry->link_name);
+ free(file_entry);
}
return(buffer);
}