]> granicus.if.org Git - apache/commitdiff
set free()d pointers to NULL to avoid potential use-after-free bugs
authorStefan Fritsch <sf@apache.org>
Tue, 3 Aug 2010 19:36:03 +0000 (19:36 +0000)
committerStefan Fritsch <sf@apache.org>
Tue, 3 Aug 2010 19:36:03 +0000 (19:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@982011 13f79535-47bb-0310-9956-ffa450edef68

modules/ldap/util_ldap.c

index 7ec5adf7953148908ea7e196c85f626b02bb608e..5fa013b11b1ab56a44138bfcb6f1c84fc59fe4b5 100644 (file)
@@ -206,9 +206,11 @@ static apr_status_t uldap_connection_cleanup(void *param)
         /* free the username and password */
         if (ldc->bindpw) {
             free((void*)ldc->bindpw);
+            ldc->bindpw = NULL;
         }
         if (ldc->binddn) {
             free((void*)ldc->binddn);
+            ldc->binddn = NULL;
         }
         /* ldc->reason is allocated from r->pool */
         if (ldc->reason) {
@@ -217,7 +219,7 @@ static apr_status_t uldap_connection_cleanup(void *param)
         /* unlock this entry */
         uldap_connection_close(ldc);
 
-     }
+    }
 
     return APR_SUCCESS;
 }