svn commit: samba r14272 - branches/SAMBA_3_0/source/utils
trunk/source/utils
jmcd at samba.org
jmcd at samba.org
Mon Mar 13 00:35:34 GMT 2006
Author: jmcd
Date: 2006-03-13 00:35:33 +0000 (Mon, 13 Mar 2006)
New Revision: 14272
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14272
Log:
Fix Coverity # 81: free alloc'ed storage before returning
Modified:
branches/SAMBA_3_0/source/utils/smbcacls.c
trunk/source/utils/smbcacls.c
Changeset:
Modified: branches/SAMBA_3_0/source/utils/smbcacls.c
===================================================================
--- branches/SAMBA_3_0/source/utils/smbcacls.c 2006-03-13 00:30:23 UTC (rev 14271)
+++ branches/SAMBA_3_0/source/utils/smbcacls.c 2006-03-13 00:35:33 UTC (rev 14272)
@@ -378,7 +378,7 @@
{
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 @@
if (!owner_sid ||
!StringToSid(owner_sid, tok+6)) {
printf("Failed to parse owner sid\n");
- return NULL;
+ goto done;
}
continue;
}
@@ -406,7 +406,7 @@
if (!grp_sid ||
!StringToSid(grp_sid, tok+6)) {
printf("Failed to parse group sid\n");
- return NULL;
+ goto done;
}
continue;
}
@@ -414,22 +414,23 @@
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);
Modified: trunk/source/utils/smbcacls.c
===================================================================
--- trunk/source/utils/smbcacls.c 2006-03-13 00:30:23 UTC (rev 14271)
+++ trunk/source/utils/smbcacls.c 2006-03-13 00:35:33 UTC (rev 14272)
@@ -378,7 +378,7 @@
{
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 @@
if (!owner_sid ||
!StringToSid(owner_sid, tok+6)) {
printf("Failed to parse owner sid\n");
- return NULL;
+ goto done;
}
continue;
}
@@ -406,7 +406,7 @@
if (!grp_sid ||
!StringToSid(grp_sid, tok+6)) {
printf("Failed to parse group sid\n");
- return NULL;
+ goto done;
}
continue;
}
@@ -414,22 +414,23 @@
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);
More information about the samba-cvs
mailing list