com php-src: Fix leak in gmp_pow(): ext/gmp/gmp.c
| From: | Nikita Popov | Date: | Thu, 16 Apr 2015 14:00:47 +0000 |
| Subject: | com php-src: Fix leak in gmp_pow(): ext/gmp/gmp.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86332@lists.php.net to get a copy of this message | ||
Commit: feaabd09d092e606b56bf745c6d6d032a7c7c1d7
Author: Nikita Popov <nikic@php.net> Thu, 16 Apr 2015 16:00:31 +0200
Parents: c77d97f356d07b109058b399c47b14c798845dc0
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=feaabd09d092e606b56bf745c6d6d032a7c7c1d7
Log:
Fix leak in gmp_pow()
Changed paths:
M ext/gmp/gmp.c
Diff:
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 9583934..f2959a0 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -1388,11 +1388,12 @@ ZEND_FUNCTION(gmp_pow)
RETURN_FALSE;
}
- INIT_GMP_RETVAL(gmpnum_result);
if (Z_TYPE_P(base_arg) == IS_LONG && Z_LVAL_P(base_arg) >= 0) {
+ INIT_GMP_RETVAL(gmpnum_result);
mpz_ui_pow_ui(gmpnum_result, Z_LVAL_P(base_arg), exp);
} else {
FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base);
+ INIT_GMP_RETVAL(gmpnum_result);
mpz_pow_ui(gmpnum_result, gmpnum_base, exp);
FREE_GMP_TEMP(temp_base);
}