summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath2001-10-08 13:10:12 +0000
committerGlenn L McGrath2001-10-08 13:10:12 +0000
commit9b2589dafde8efc5327e597690c84bfbfe42d53f (patch)
tree72305feb2a6502f7f82c6e6eaabccf8aab222dcd
parentdfa7b0eff68c91a1bea329d1056390b74e11265a (diff)
downloadbusybox-9b2589dafde8efc5327e597690c84bfbfe42d53f.zip
busybox-9b2589dafde8efc5327e597690c84bfbfe42d53f.tar.gz
Cleanup memory usage properly
-rw-r--r--libbb/unarchive.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libbb/unarchive.c b/libbb/unarchive.c
index beb3969..e23acff 100644
--- a/libbb/unarchive.c
+++ b/libbb/unarchive.c
@@ -267,7 +267,9 @@ char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers
seek_sub_file(src_stream, file_entry->size);
}
free(file_entry->name); /* may be null, but doesn't matter */
- free(file_entry->link_name);
+ if (file_entry->link_name) {
+ free(file_entry->link_name);
+ }
free(file_entry);
}
return(buffer);
@@ -614,8 +616,10 @@ char *deb_extract(const char *package_filename, FILE *out_stream,
fclose(deb_stream);
fclose(uncompressed_stream);
free(ared_file);
- free(file_list[0]);
- free(file_list);
+ if (filename != NULL) {
+ free(file_list[0]);
+ free(file_list);
+ }
return(output_buffer);
}
#endif