Skip to content

Commit 420068c

Browse files
committed
- Fix possible memory leak
1 parent 85a622e commit 420068c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ext/zip/php_zip.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,15 +1856,16 @@ static ZIPARCHIVE_METHOD(addFromString)
18561856
/* TODO: fix _zip_replace */
18571857
if (cur_idx >= 0) {
18581858
if (zip_delete(intern, cur_idx) == -1) {
1859-
RETURN_FALSE;
1859+
goto fail;
18601860
}
18611861
}
18621862

1863-
if (zip_add(intern, name, zs) == -1) {
1864-
RETURN_FALSE;
1865-
} else {
1863+
if (zip_add(intern, name, zs) != -1) {
18661864
RETURN_TRUE;
18671865
}
1866+
fail:
1867+
zip_source_free(zs);
1868+
RETURN_FALSE;
18681869
}
18691870
/* }}} */
18701871

0 commit comments

Comments
 (0)