diff options
author | Yasuo Ohgaki <yohgaki@php.net> | 2013-10-22 12:23:07 +0900 |
---|---|---|
committer | Yasuo Ohgaki <yohgaki@php.net> | 2013-10-22 12:23:07 +0900 |
commit | 2cf5614f5fb6dc250567900a31d1bdd3c534f0d8 (patch) | |
tree | 85bfec161e39c8b12a778468d2235730c9b59a0e /ext/zip/php_zip.c | |
parent | 9789df77643c34ffdcfc71049b4c57b45efd0d48 (diff) | |
parent | 5cc797d119bb3936a8acce48ede04fa29a3219c6 (diff) | |
download | php-git-2cf5614f5fb6dc250567900a31d1bdd3c534f0d8.tar.gz |
Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
* 'PHP-5.4' of git.php.net:php-src: (101 commits)
exif NEWS
add tests for bug #62523
Merged PR #293 (Exif crash on unknown encoding was fixed) By: Draal Conflicts: configure.in main/php_version.h
Just SKIP that test on travis
fix memory leak on error (from Coverity scan)
Fix coverity issue with -1 returned by findOffset not being handled by getPreferredTag
5.4.21 release date
When src->src is null this doesn't get initialized but it is still used, so the passed in *ze will point to unitialized memory. Hopefully src->src is never null, but just in case this initialization doesn't hurt.
Fix typo
Clean up this weird safe_emalloc() call
Minor Coverity tweaks
- Moved NULL check before dereferencing
- Fixed possible NULL ptr dereference
- Fixed possible uninitialized scalar variable usage (spotted by Coverity)
Remove senseless check here
- Fix extern declaration according to definition
- Fix possible memory leak
- Moved allocation to if block to make Coverity happy
- Fixed possible memory leak
Fix unitialized opened_path here - found by Coverity
...
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r-- | ext/zip/php_zip.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index d7bd5f49e6..1f435bbb00 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -102,14 +102,14 @@ static char * php_zip_make_relative_path(char *path, int path_len) /* {{{ */ char *path_begin = path; size_t i; - if (IS_SLASH(path[0])) { - return path + 1; - } - if (path_len < 1 || path == NULL) { return NULL; } + if (IS_SLASH(path[0])) { + return path + 1; + } + i = path_len; while (1) { @@ -1856,15 +1856,16 @@ static ZIPARCHIVE_METHOD(addFromString) /* TODO: fix _zip_replace */ if (cur_idx >= 0) { if (zip_delete(intern, cur_idx) == -1) { - RETURN_FALSE; + goto fail; } } - if (zip_add(intern, name, zs) == -1) { - RETURN_FALSE; - } else { + if (zip_add(intern, name, zs) != -1) { RETURN_TRUE; } +fail: + zip_source_free(zs); + RETURN_FALSE; } /* }}} */ |