From: Dmitry Stogov Date: Fri, 20 Jun 2014 06:27:24 +0000 (+0400) Subject: Fixed compilation X-Git-Tag: POST_PHPNG_MERGE~163 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e9176731f299335a65602c298e1683543e88b6d;p=php Fixed compilation --- diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c index 7f554dcb7b..326fc233c8 100644 --- a/ext/mysqlnd/mysqlnd_auth.c +++ b/ext/mysqlnd/mysqlnd_auth.c @@ -543,20 +543,18 @@ mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn, DBG_ERR("server_public_key is not set"); DBG_RETURN(NULL); } else { - char * key_str = NULL; + zend_string * key_str; DBG_INF_FMT("Key in a file. [%s]", fname); stream = php_stream_open_wrapper((char *) fname, "rb", REPORT_ERRORS, NULL); if (stream) { - if ((len = php_stream_copy_to_mem(stream, &key_str, PHP_STREAM_COPY_ALL, 0)) >= 0 ) { - BIO * bio = BIO_new_mem_buf(key_str, len); + if ((key_str = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) { + BIO * bio = BIO_new_mem_buf(key_str->val, key_str->len); ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL); BIO_free(bio); DBG_INF("Successfully loaded"); - } - if (key_str) { - DBG_INF_FMT("Public key:%*.s", len, key_str); - efree(key_str); + DBG_INF_FMT("Public key:%*.s", key_str->len, key_str->val); + STR_RELEASE(key_str); } php_stream_free(stream, PHP_STREAM_FREE_CLOSE); }