]> git.sur5r.net Git - openldap/blobdiff - libraries/librewrite/session.c
plug potential ld_error leak (ITS#4064)
[openldap] / libraries / librewrite / session.c
index 4d05dd1fcea4ffa36d2a705b6df3750bea707647..bd0685167c926dab95868cd30e893df163a7e7d3 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2004 The OpenLDAP Foundation.
+ * Copyright 2000-2005 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -177,7 +177,7 @@ rewrite_session_return(
                struct rewrite_session *session
 )
 {
-       assert( session );
+       assert( session != NULL );
        ldap_pvt_thread_mutex_unlock( &session->ls_mutex );
 }
 
@@ -204,6 +204,13 @@ rewrite_session_var_set_f(
        session = rewrite_session_find( info, cookie );
        if ( session == NULL ) {
                session = rewrite_session_init( info, cookie );
+               if ( session == NULL ) {
+                       return REWRITE_ERR;
+               }
+
+#ifdef USE_REWRITE_LDAP_PVT_THREADS
+               ldap_pvt_thread_mutex_lock( &session->ls_mutex );
+#endif /* USE_REWRITE_LDAP_PVT_THREADS */
        }
 
 #ifdef USE_REWRITE_LDAP_PVT_THREADS