com php-src: Some commentary, change free method: ext/openssl/openssl.c

From: Date: Fri, 06 Jan 2017 15:49:15 +0000
Subject: com php-src: Some commentary, change free method: ext/openssl/openssl.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-96592@lists.php.net to get a copy of this message
Commit: 62e9e1fecd1f2fd9981244889389dfd3f92eb4d2 Author: Leigh <leigh@php.net> Fri, 6 Jan 2017 15:49:15 +0000 Parents: 9a0dac124e42cf5919ecbdff6ee814688a789292 Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=62e9e1fecd1f2fd9981244889389dfd3f92eb4d2 Log: Some commentary, change free method Changed paths: M ext/openssl/openssl.c Diff: diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 323bdcf..2e90c7c 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -683,9 +683,11 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s str = X509_NAME_ENTRY_get_data(ne); if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) { + /* ASN1_STRING_to_UTF8(3): The converted data is copied into a newly allocated buffer */ to_add_len = ASN1_STRING_to_UTF8(&to_add, str); needs_free = 1; } else { + /* ASN1_STRING_data(3): Since this is an internal pointer it should not be freed or modified in any way */ to_add = ASN1_STRING_data(str); to_add_len = ASN1_STRING_length(str); } @@ -706,8 +708,8 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s } if (needs_free) { - OPENSSL_free(to_add); - to_add = NULL; + /* ASN1_STRING_to_UTF8(3): The buffer out should be freed using free(3) */ + free(to_add); needs_free = 0; } }

« previous php.cvs (#96592) next »