r15980: Correctly destroy talloc_ctx when the LDAP posix attribute query has
authorGünther Deschner <gd@samba.org>
Wed, 31 May 2006 10:32:12 +0000 (10:32 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:17:16 +0000 (11:17 -0500)
failed. Noticed by Bob Gautier.

Guenther
(This used to be commit 7327f94546a90df25c688dcafd42e0993133057a)

source3/libads/ldap_schema.c

index a0c735208faede681f26d13c8fc95a431e606189..13a8ab0cb0b448c08d9e3f9f695e8a58abe6eff2 100644 (file)
@@ -303,13 +303,14 @@ ADS_STATUS ads_check_posix_schema_mapping(ADS_STRUCT *ads, enum wb_posix_mapping
                }
        }
 
-       talloc_destroy(ctx);
-       
-       ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_uidnumber_attr);
-       ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_gidnumber_attr);
-       ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_homedir_attr);
-       ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_shell_attr);
-       ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_gecos_attr);
+       if (!ads->schema.posix_uidnumber_attr ||
+           !ads->schema.posix_gidnumber_attr ||
+           !ads->schema.posix_homedir_attr ||
+           !ads->schema.posix_shell_attr ||
+           !ads->schema.posix_gecos_attr) {
+               status = ADS_ERROR(LDAP_NO_MEMORY);
+               goto done;
+       }
        
        status = ADS_ERROR(LDAP_SUCCESS);