Fixed memory leaks.

This commit is contained in:
Armin Novak 2014-11-17 00:09:50 +01:00
parent 54224d4155
commit 3d108f0bca
1 changed files with 15 additions and 0 deletions

View File

@ -683,7 +683,12 @@ int makecert_context_output_private_key_file(MAKECERT_CONTEXT* context, char* pa
bio = BIO_new(BIO_s_mem());
if (!bio)
{
free (filename);
free(fullpath);
fclose(fp);
return -1;
}
status = PEM_write_bio_PrivateKey(bio, context->pkey, NULL, NULL, 0, NULL, NULL);
@ -694,7 +699,12 @@ int makecert_context_output_private_key_file(MAKECERT_CONTEXT* context, char* pa
status = BIO_read(bio, x509_str, length);
if (status < 0)
{
free (filename);
free(fullpath);
fclose(fp);
return -1;
}
offset += status;
@ -712,7 +722,12 @@ int makecert_context_output_private_key_file(MAKECERT_CONTEXT* context, char* pa
}
if (status < 0)
{
free (filename);
free(fullpath);
fclose(fp);
return -1;
}
length = offset;