]> git.sur5r.net Git - openldap/commitdiff
ITS#7783 workaround stupid NSPR bug
authorHoward Chu <hyc@openldap.org>
Sun, 12 Jan 2014 21:43:55 +0000 (13:43 -0800)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 13 Jan 2014 19:49:11 +0000 (13:49 -0600)
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

index 36dc989ef0c42fd84f226a6194e8ec2b10a5ccae..136feaadb059938f3fb618b00445ccd0b280d6e9 100644 (file)
@@ -2066,8 +2066,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 ) {
@@ -2317,7 +2319,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 );
                }
        }