diff options
author | Jim McDonough <jmcd@samba.org> | 2006-03-13 00:35:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:15:22 -0500 |
commit | 30e751c56b684e027117bee1df9924477f55bc88 (patch) | |
tree | 9cf89f9834556cd38c1910fd5c279755337160d7 /source3/utils/smbcacls.c | |
parent | 34e02ea01437f1d5e9cd24f438753ab41766cafe (diff) | |
download | samba-30e751c56b684e027117bee1df9924477f55bc88.tar.gz samba-30e751c56b684e027117bee1df9924477f55bc88.tar.xz samba-30e751c56b684e027117bee1df9924477f55bc88.zip |
r14272: Fix Coverity # 81: free alloc'ed storage before returning
(This used to be commit 1899d8ea283845141b24d91d230248009744fe1a)
Diffstat (limited to 'source3/utils/smbcacls.c')
-rw-r--r-- | source3/utils/smbcacls.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index cff3bc5dde4..8c08e7f2f14 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -378,7 +378,7 @@ static SEC_DESC *sec_desc_parse(char *str) { const char *p = str; fstring tok; - SEC_DESC *ret; + SEC_DESC *ret = NULL; size_t sd_size; DOM_SID *grp_sid=NULL, *owner_sid=NULL; SEC_ACL *dacl=NULL; @@ -396,7 +396,7 @@ static SEC_DESC *sec_desc_parse(char *str) if (!owner_sid || !StringToSid(owner_sid, tok+6)) { printf("Failed to parse owner sid\n"); - return NULL; + goto done; } continue; } @@ -406,7 +406,7 @@ static SEC_DESC *sec_desc_parse(char *str) if (!grp_sid || !StringToSid(grp_sid, tok+6)) { printf("Failed to parse group sid\n"); - return NULL; + goto done; } continue; } @@ -414,22 +414,23 @@ static SEC_DESC *sec_desc_parse(char *str) if (strncmp(tok,"ACL:", 4) == 0) { SEC_ACE ace; if (!parse_ace(&ace, tok+4)) { - return NULL; + goto done; } if(!add_ace(&dacl, &ace)) { printf("Failed to add ACL %s\n", tok); - return NULL; + goto done; } continue; } printf("Failed to parse token '%s' in security descriptor,\n", tok); - return NULL; + goto done; } ret = make_sec_desc(ctx,revision, SEC_DESC_SELF_RELATIVE, owner_sid, grp_sid, NULL, dacl, &sd_size); + done: SAFE_FREE(grp_sid); SAFE_FREE(owner_sid); |