projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6f6f28b
)
zip-reader.c: Fix memory leak
author
John Darrington
<john@darrington.wattle.id.au>
Thu, 7 Mar 2013 20:45:43 +0000
(21:45 +0100)
committer
John Darrington
<john@darrington.wattle.id.au>
Thu, 7 Mar 2013 20:45:43 +0000
(21:45 +0100)
src/libpspp/zip-reader.c
patch
|
blob
|
history
diff --git
a/src/libpspp/zip-reader.c
b/src/libpspp/zip-reader.c
index a36bd6f25f24d3db7176f403bbea9337017740b1..3f1d277c92ab140e19653e4383a116bdeb86c1d8 100644
(file)
--- a/
src/libpspp/zip-reader.c
+++ b/
src/libpspp/zip-reader.c
@@
-384,7
+384,7
@@
zip_member_open (struct zip_reader *zr, const char *member)
uint32_t ucomp_size, comp_size;
uint32_t crc;
uint32_t ucomp_size, comp_size;
uint32_t crc;
-
+ bool new_member = false;
char *name = NULL;
int i;
char *name = NULL;
int i;
@@
-398,7
+398,10
@@
zip_member_open (struct zip_reader *zr, const char *member)
zm = zr->members[i];
if (zm == NULL)
zm = zr->members[i];
if (zm == NULL)
- zm = zr->members[i] = zip_header_read_next (zr);
+ {
+ zm = zr->members[i] = zip_header_read_next (zr);
+ new_member = true;
+ }
if (zm && 0 == strcmp (zm->name, member))
break;
else
if (zm && 0 == strcmp (zm->name, member))
break;
else
@@
-452,8
+455,11
@@
zip_member_open (struct zip_reader *zr, const char *member)
free (name);
zm->bytes_unread = zm->ucomp_size;
free (name);
zm->bytes_unread = zm->ucomp_size;
+
+ if ( !new_member)
+ decompressors[zm->compression].finish (zm);
- if (
!
decompressors[zm->compression].init (zm) )
+ if (
!
decompressors[zm->compression].init (zm) )
return NULL;
return zm;
return NULL;
return zm;