Author: vlendec Date: 2005-12-10 09:18:03 +0000 (Sat, 10 Dec 2005) New Revision: 12161
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12161 Log: Fix a memleak and do the -O1 janitor :-) Modified: branches/SAMBA_4_0/source/dsdb/samdb/samdb.c branches/SAMBA_4_0/source/libcli/security/sddl.c Changeset: Modified: branches/SAMBA_4_0/source/dsdb/samdb/samdb.c =================================================================== --- branches/SAMBA_4_0/source/dsdb/samdb/samdb.c 2005-12-10 01:33:58 UTC (rev 12160) +++ branches/SAMBA_4_0/source/dsdb/samdb/samdb.c 2005-12-10 09:18:03 UTC (rev 12161) @@ -1004,7 +1004,7 @@ const char *attrs[] = { "rootDomainNamingContext", NULL }; int ret; struct ldb_result *res = NULL; - TALLOC_CTX *tmp_ctx = talloc_new(ldb); + TALLOC_CTX *tmp_ctx; struct dom_sid *domain_sid; const char *basedn_s; struct ldb_dn *basedn; @@ -1015,6 +1015,11 @@ return domain_sid; } + tmp_ctx = talloc_new(ldb); + if (tmp_ctx == NULL) { + goto failed; + } + basedn = ldb_dn_explode(tmp_ctx, ""); if (basedn == NULL) { goto failed; Modified: branches/SAMBA_4_0/source/libcli/security/sddl.c =================================================================== --- branches/SAMBA_4_0/source/libcli/security/sddl.c 2005-12-10 01:33:58 UTC (rev 12160) +++ branches/SAMBA_4_0/source/libcli/security/sddl.c 2005-12-10 09:18:03 UTC (rev 12161) @@ -448,12 +448,16 @@ static char *sddl_encode_ace(TALLOC_CTX *mem_ctx, const struct security_ace *ace, const struct dom_sid *domain_sid) { - char *sddl; + char *sddl = NULL; TALLOC_CTX *tmp_ctx; const char *s_type="", *s_flags="", *s_mask="", *s_object="", *s_iobject="", *s_trustee=""; tmp_ctx = talloc_new(mem_ctx); + if (tmp_ctx == NULL) { + DEBUG(0, ("talloc_new failed\n")); + return NULL; + } s_type = sddl_flags_to_string(tmp_ctx, ace_types, ace->type, True); if (s_type == NULL) goto failed;