opkg: fix some initialisation and double free issues in libbb
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:12:11 +0000 (05:12 +0000)
committerticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:12:11 +0000 (05:12 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@85 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libbb/unarchive.c
libbb/unzip.c

index 24578241ad5e762bad9b3a6d30d7cc57612705f9..5fc5725e06114fa67f54e48b58d3947e0c9b8846 100644 (file)
@@ -715,7 +715,7 @@ char *deb_extract(const char *package_filename, FILE *out_stream,
        char *output_buffer = NULL;
        char *ared_file = NULL;
        char ar_magic[8];
        char *output_buffer = NULL;
        char *ared_file = NULL;
        char ar_magic[8];
-       int gunzip_pid;
+       int gunzip_pid = 0;
 
        if (filename != NULL) {
                file_list = xmalloc(sizeof(char *) * 2);
 
        if (filename != NULL) {
                file_list = xmalloc(sizeof(char *) * 2);
index 3826316bb168a0e1b51dd2f775ca9834f4c63c42..fb2429bf058a560eb724099272782854871da215 100644 (file)
@@ -71,7 +71,7 @@ static FILE *in_file, *out_file;
 
 /* these are freed by gz_close */
 static unsigned char *window;
 
 /* these are freed by gz_close */
 static unsigned char *window;
-static unsigned long *crc_table;
+static unsigned long *crc_table = NULL;
 
 static unsigned long crc; /* shift register contents */
 
 
 static unsigned long crc; /* shift register contents */
 
@@ -1020,6 +1020,9 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
        free(window);
        free(crc_table);
 
        free(window);
        free(crc_table);
 
+       window = NULL;
+       crc_table = NULL;
+
        return exit_code;
 }
 
        return exit_code;
 }