From f6a19bd728d5a94b2575477942210cdb2a93ef70 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Tue, 14 May 2013 13:26:51 +0200
Subject: [PATCH] Possible resource leak on FILE* removed in X509 parse
---
library/x509parse.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/library/x509parse.c b/library/x509parse.c
index 3e99bdca9a..3ddfb14c6b 100644
--- a/library/x509parse.c
+++ b/library/x509parse.c
@@ -1812,7 +1812,10 @@ int load_file( const char *path, unsigned char **buf, size_t *n )
fseek( f, 0, SEEK_SET );
if( ( *buf = (unsigned char *) malloc( *n + 1 ) ) == NULL )
+ {
+ fclose( f );
return( POLARSSL_ERR_X509_MALLOC_FAILED );
+ }
if( fread( *buf, 1, *n, f ) != *n )
{