From d15f4e2f09b7b046e44c361a3b7295676933a3f3 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 12 Jan 2014 13:43:55 -0800 Subject: [PATCH] ITS#7783 workaround stupid NSPR bug free(NULL) is supposed to be safe. "Portable wrapper libraries" that fail to preserve this behavior are inherently broken. But then again, this is Mozilla code, so that's redundant. --- libraries/libldap/tls_m.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libraries/libldap/tls_m.c b/libraries/libldap/tls_m.c index 072d41d56c..3dc575dc94 100644 --- a/libraries/libldap/tls_m.c +++ b/libraries/libldap/tls_m.c @@ -2064,8 +2064,10 @@ tlsm_ctx_free ( tls_ctx *ctx ) errcode, PR_ErrorToString( errcode, PR_LANGUAGE_I_DEFAULT ), 0 ); } } - PL_strfree( c->tc_pin_file ); - c->tc_pin_file = NULL; + if ( c->tc_pin_file ) { + PL_strfree( c->tc_pin_file ); + c->tc_pin_file = NULL; + } tlsm_free_pem_objs( c ); #ifdef HAVE_NSS_INITCONTEXT if ( c->tc_initctx ) { @@ -2315,7 +2317,8 @@ tlsm_deferred_ctx_init( void *arg ) return rc; } } else { - PL_strfree( ctx->tc_pin_file ); + if ( ctx->tc_pin_file ) + PL_strfree( ctx->tc_pin_file ); ctx->tc_pin_file = PL_strdup( lt->lt_keyfile ); } } -- 2.39.5