Remove hack for PHP 4 in freeing encryptkeys and fix CS

This commit is contained in:
Jakub Zelenka 2017-09-12 18:50:50 +01:00
parent 2b3d5b5a29
commit 3bb4d28798

View file

@ -88,14 +88,10 @@ static void php_gnupg_free_encryptkeys(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC)
if (PHPC_THIS) { if (PHPC_THIS) {
int idx; int idx;
/* loop through all encryptkeys and unref them in the gpgme-lib */ /* 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]); gpgme_key_unref(PHPC_THIS->encryptkeys[idx]);
} }
/* it's an odd-thing, but other solutions makes problems : efree(PHPC_THIS->encryptkeys);
* 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));
PHPC_THIS->encryptkeys = NULL; PHPC_THIS->encryptkeys = NULL;
PHPC_THIS->encrypt_size = 0; PHPC_THIS->encrypt_size = 0;
} }