com php-src: Improves fix for memory leak, keep in sync with upstream.: ext/fileinfo/libmagic/softmagic.c

From: Date: Wed, 05 Mar 2014 09:52:29 +0000
Subject: com php-src: Improves fix for memory leak, keep in sync with upstream.: ext/fileinfo/libmagic/softmagic.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-76342@lists.php.net to get a copy of this message
Commit: 1677be7a30e5d4bf7dd452f9a76c277238f27b6f Author: Remi Collet <remi@php.net> Tue, 4 Mar 2014 13:41:37 +0100 Committer: Julien Pauli <jpauli@php.net> Wed, 5 Mar 2014 10:52:29 +0100 Parents: 61bcea70199b94d057ff60fb666a279376c8af2d Branches: PHP-5.5.10 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1677be7a30e5d4bf7dd452f9a76c277238f27b6f Log: Improves fix for memory leak, keep in sync with upstream. Previous fix: http://git.php.net/?p=php-src.git;a=commitdiff;h=10eb0070700382f966bf260e44135e1f724a15d2 Upstream fix: https://github.com/glensc/file/commit/c0c0032b9e9eb57b91fefef905a3b018bab492d9 Changed paths: M ext/fileinfo/libmagic/softmagic.c Diff: diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c index 33970e5..82a470a 100644 --- a/ext/fileinfo/libmagic/softmagic.c +++ b/ext/fileinfo/libmagic/softmagic.c @@ -1696,11 +1696,19 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m, ms->o.buf = sbuf; ms->offset = soffset; if (rv == 1) { - if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && - file_printf(ms, m->desc, offset) == -1) - return -1; - if (file_printf(ms, "%s", rbuf) == -1) + if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && + file_printf(ms, m->desc, offset) == -1) { + if (rbuf) { + efree(rbuf); + } + return -1; + } + if (file_printf(ms, "%s", rbuf) == -1) { + if (rbuf) { + efree(rbuf); + } return -1; + } } if (rbuf) { efree(rbuf);

« previous php.cvs (#76342) next »