]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix krb5_ldap_put_password_policy cleanup
authorGreg Hudson <ghudson@mit.edu>
Thu, 28 Mar 2013 19:21:10 +0000 (15:21 -0400)
committerGreg Hudson <ghudson@mit.edu>
Thu, 28 Mar 2013 19:21:10 +0000 (15:21 -0400)
Initialize policy_dn since we clean it up.  Also free it
unconditionally.

src/plugins/kdb/ldap/libkdb_ldap/ldap_pwd_policy.c

index 433fb75b9bc0607473562b32a9c301381533dd5f..c6fdbb4941a9bbfeca345244d723799aa9cf6d41 100644 (file)
@@ -189,7 +189,7 @@ cleanup:
 krb5_error_code
 krb5_ldap_put_password_policy(krb5_context context, osa_policy_ent_t policy)
 {
-    char                        *policy_dn;
+    char                        *policy_dn=NULL;
     krb5_error_code             st=0;
     LDAP                        *ld=NULL;
     LDAPMod                     **mods=NULL;
@@ -227,8 +227,7 @@ krb5_ldap_put_password_policy(krb5_context context, osa_policy_ent_t policy)
     }
 
 cleanup:
-    if (policy_dn != NULL)
-        free (policy_dn);
+    free(policy_dn);
     ldap_mods_free(mods, 1);
     krb5_ldap_put_handle_to_pool(ldap_context, ldap_server_handle);
     return(st);