From: Fabian Keil Date: Tue, 26 Nov 2019 12:01:22 +0000 (+0100) Subject: write_private_key(): Use zalloc_or_die() X-Git-Tag: v_3_0_29~552 X-Git-Url: http://www.privoxy.org/gitweb/team/%22/11member_t.jpg?a=commitdiff_plain;h=afe7083b9bba1380983a5f04792a8e92c57efc1b;p=privoxy.git write_private_key(): Use zalloc_or_die() --- diff --git a/ssl.c b/ssl.c index b239a29c..d64f6082 100644 --- a/ssl.c +++ b/ssl.c @@ -1032,15 +1032,7 @@ static int write_private_key(mbedtls_pk_context *key, unsigned char **ret_buf, memset(err_buf, 0, sizeof(err_buf)); /* Initializing buffer for key file content */ - *ret_buf = (unsigned char *)malloc(PRIVATE_KEY_BUF_SIZE + 1); - if (*ret_buf == NULL) - { - log_error(LOG_LEVEL_ERROR, - "Creating buffer for private key failed: malloc fail"); - ret = -1; - goto exit; - } - memset(*ret_buf, 0, PRIVATE_KEY_BUF_SIZE + 1); + *ret_buf = zalloc_or_die(PRIVATE_KEY_BUF_SIZE + 1); /* * Writing private key into PEM string