From: Greg Beaver Date: Sat, 23 Feb 2008 14:59:52 +0000 (+0000) Subject: free spprintf'ed stub after using it X-Git-Tag: RELEASE_2_0_0a1~378 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0e6457b2cfa33e5110d6b32b48adee06dc38d161;p=php free spprintf'ed stub after using it --- diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 7085d9f030..1b40ce5bc4 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -2212,7 +2212,7 @@ PHP_METHOD(Phar, setStub) { char *index = NULL, *webindex = NULL, *error = NULL; char *stub = "dummy"; - int index_len = 0, webindex_len = 0; + int index_len = 0, webindex_len = 0, created_stub = 0; size_t stub_len = 0; PHAR_ARCHIVE_OBJECT(); @@ -2237,11 +2237,18 @@ PHP_METHOD(Phar, setStub) if (error) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, error); efree(error); + if (stub) { + efree(stub); + } RETURN_FALSE; } + created_stub = 1; } phar_flush(phar_obj->arc.archive, stub, stub_len, &error TSRMLS_CC); + if (created_stub) { + efree(stub); + } if (error) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error);