From 0e6457b2cfa33e5110d6b32b48adee06dc38d161 Mon Sep 17 00:00:00 2001 From: Greg Beaver Date: Sat, 23 Feb 2008 14:59:52 +0000 Subject: [PATCH] free spprintf'ed stub after using it --- ext/phar/phar_object.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); -- 2.50.1