4e8cda1025
- add zip-3.0-fix-memory_leaks.patch to fix memory leaks in zip.c, zipfile.c and fileio.c files [bsc#1068346] OBS-URL: https://build.opensuse.org/request/show/546270 OBS-URL: https://build.opensuse.org/package/show/Archiving/zip?expand=0&rev=17
66 lines
1.7 KiB
Diff
66 lines
1.7 KiB
Diff
--- zipfile.c
|
|
+++ zipfile.c
|
|
@@ -2166,7 +2166,7 @@ int readlocal(localz, z)
|
|
#ifndef UTIL
|
|
ulg start_disk = 0;
|
|
uzoff_t start_offset = 0;
|
|
- char *split_path;
|
|
+ char *split_path = NULL;
|
|
|
|
start_disk = z->dsk;
|
|
start_offset = z->off;
|
|
@@ -2197,6 +2197,7 @@ int readlocal(localz, z)
|
|
split_path = get_in_split_path(in_path, start_disk);
|
|
}
|
|
}
|
|
+ if (split_path) free(split_path);
|
|
#endif
|
|
|
|
/* For utilities assume archive is on one disk for now */
|
|
@@ -6014,7 +6015,7 @@ int zipcopy(z)
|
|
ulg e = 0; /* extended local header size */
|
|
ulg start_disk = 0;
|
|
uzoff_t start_offset = 0;
|
|
- char *split_path;
|
|
+ char *split_path = NULL;
|
|
char buf[LOCHEAD + 1];
|
|
struct zlist far *localz;
|
|
int r;
|
|
@@ -6063,6 +6064,7 @@ int zipcopy(z)
|
|
split_path = get_in_split_path(in_path, start_disk);
|
|
}
|
|
}
|
|
+ if (split_path) free(split_path);
|
|
|
|
if (zfseeko(in_file, start_offset, SEEK_SET) != 0) {
|
|
fclose(in_file);
|
|
--- zip.c
|
|
+++ zip.c
|
|
@@ -3450,6 +3450,7 @@ char **argv; /* command line
|
|
}
|
|
}
|
|
*/
|
|
+ free(value); /* Added by Polo from forum */
|
|
if (kk == 3) {
|
|
first_listarg = argnum;
|
|
kk = 4;
|
|
--- fileio.c
|
|
+++ fileio.c
|
|
@@ -696,6 +696,7 @@ int newnamew(namew, isdir, casesensitive
|
|
return ZE_MEM;
|
|
}
|
|
strcpy(z->name, name);
|
|
+ if (z->oname) free(z->oname);
|
|
z->oname = oname;
|
|
oname = NULL;
|
|
z->dosflag = dosflag;
|
|
@@ -959,6 +960,7 @@ int newname(name, isdir, casesensitive)
|
|
return ZE_MEM;
|
|
}
|
|
strcpy(z->name, name);
|
|
+ if (z->oname) free(z->oname);
|
|
z->oname = oname;
|
|
z->dosflag = dosflag;
|
|
|
|
|