From 3bb4d28798079c73840d15c10dd4b1e4889447cf Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Tue, 12 Sep 2017 18:50:50 +0100 Subject: [PATCH] Remove hack for PHP 4 in freeing encryptkeys and fix CS --- gnupg.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gnupg.c b/gnupg.c index c77ea96..8cc84d4 100644 --- a/gnupg.c +++ b/gnupg.c @@ -88,14 +88,10 @@ static void php_gnupg_free_encryptkeys(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) if (PHPC_THIS) { int idx; /* loop through all encryptkeys and unref them in the gpgme-lib */ - for (idx=0; idx < PHPC_THIS->encrypt_size; idx++) { + for (idx = 0; idx < PHPC_THIS->encrypt_size; idx++) { gpgme_key_unref(PHPC_THIS->encryptkeys[idx]); } - /* it's an odd-thing, but other solutions makes problems : - * erealloc(x,0) gives a segfault with PHP 4 and debug enabled - * efree(x) alone ends in a segfault - */ - efree(erealloc(PHPC_THIS->encryptkeys, 0)); + efree(PHPC_THIS->encryptkeys); PHPC_THIS->encryptkeys = NULL; PHPC_THIS->encrypt_size = 0; }