MozNSS Compat. Layer: Fix memleaks reported by valgrind

Resolves: #1595203
This commit is contained in:
Matúš Honěk 2018-06-29 17:35:41 +02:00
parent 44ef9ba558
commit ff45e6ac8e

View File

@ -1,7 +1,7 @@
MozNSS Interception Code
Author: Matus Honek <mhonek@redhat.com>
Date: Thu Apr 5 15:47:44 CEST 2018
Date: Thu Jun 28 14:36:55 CEST 2018
diff --git a/configure.in b/configure.in
--- a/configure.in
+++ b/configure.in
@ -283,7 +283,7 @@ diff --git a/libraries/libldap/tls_mc.c b/libraries/libldap/tls_mc.c
new file mode 100644
--- /dev/null
+++ b/libraries/libldap/tls_mc.c
@@ -0,0 +1,1346 @@
@@ -0,0 +1,1351 @@
+#include "portable.h"
+
+#ifdef HAVE_MOZNSS_COMPATIBILITY
@ -1525,6 +1525,7 @@ new file mode 100644
+ Debug( LDAP_DEBUG_ANY,
+ "tlsmc_convert: WARN: extracted cacerts dir is not present.\n",
+ 0, 0, 0 );
+ if ( *ld_cacertdir ) PR_smprintf_free( *ld_cacertdir );
+ *ld_cacertdir = NULL;
+ }
+
@ -1536,6 +1537,7 @@ new file mode 100644
+ Debug( LDAP_DEBUG_ANY,
+ "tlsmc_convert: WARN: extracted cert file is not present.\n",
+ 0, 0, 0 );
+ if ( *ld_cert ) PR_smprintf_free( *ld_cert );
+ *ld_cert = NULL;
+ }
+
@ -1547,13 +1549,16 @@ new file mode 100644
+ Debug( LDAP_DEBUG_ANY,
+ "tlsmc_convert: WARN: extracted key file is not present.\n",
+ 0, 0, 0 );
+ if ( *ld_key ) PR_smprintf_free( *ld_key );
+ *ld_key = NULL;
+ }
+
+ rv = 1;
+
+bail:
+ if ( checksum ) free( checksum );
+ if ( pem_dir ) PR_smprintf_free( pem_dir );
+ if ( readme_path ) PR_smprintf_free( readme_path );
+ if ( data ) free( data );
+ if ( nssdb_prefix ) free( nssdb_prefix );
+ if ( nssdb_dir_path ) free( nssdb_dir_path );