Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-09-03 23:32:18 +0400
committerEric Andersen <andersen@codepoet.org>2001-09-03 23:32:18 +0400
commit93fc393486bc54888fdf3cdad06b64c3e904eb6d (patch)
tree72bf80666f750003d82f2e1e5903cc39a68a2285
parent6b4d645722626c6d6ea49dcdc4189b1623df9a68 (diff)
Use the correct buffer when calling dirname, improve an error message,
and plug some memory leaks. Patch by Laurence Anderson.
-rw-r--r--busybox/libbb/unarchive.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/busybox/libbb/unarchive.c b/busybox/libbb/unarchive.c
index 0d414a3a8..4d47eff0e 100644
--- a/busybox/libbb/unarchive.c
+++ b/busybox/libbb/unarchive.c
@@ -127,13 +127,15 @@ 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 *parent = dirname(full_name);
+ char *buf, *parent;
+ buf = xstrdup(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");
}
}
- free (parent);
+ free (buf);
}
switch(file_entry->mode & S_IFMT) {
case S_IFREG:
@@ -158,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);
}
}
}
@@ -264,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);
}