]> granicus.if.org Git - php/commitdiff
Fixed compilation
authorDmitry Stogov <dmitry@zend.com>
Fri, 20 Jun 2014 06:27:24 +0000 (10:27 +0400)
committerDmitry Stogov <dmitry@zend.com>
Fri, 20 Jun 2014 06:27:24 +0000 (10:27 +0400)
ext/mysqlnd/mysqlnd_auth.c

index 7f554dcb7b1ebfc1dc879528f3c236d8c075053f..326fc233c8f2346c10960bfb8127527e75987cc5 100644 (file)
@@ -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_strlen);
+                       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);
                }