summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-01-29 17:31:12 -0800
committerJeremy Allison <jra@samba.org>2009-01-29 17:31:12 -0800
commit08802db8dbbbf842b7c006e5ff57ba1c2d0d6439 (patch)
treeb3c98fc0ed0adae6f431670614513d40c388340b
parent734647bd85560ed02691d79c0a613543043d8625 (diff)
downloadsamba-08802db8dbbbf842b7c006e5ff57ba1c2d0d6439.tar.gz
samba-08802db8dbbbf842b7c006e5ff57ba1c2d0d6439.tar.bz2
samba-08802db8dbbbf842b7c006e5ff57ba1c2d0d6439.zip
Fix coverity CID#116. Resource leak on error path.
Jeremy.
-rw-r--r--source3/libnet/libnet_samsync_ldif.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source3/libnet/libnet_samsync_ldif.c b/source3/libnet/libnet_samsync_ldif.c
index 4286331893..cee0e17e37 100644
--- a/source3/libnet/libnet_samsync_ldif.c
+++ b/source3/libnet/libnet_samsync_ldif.c
@@ -542,8 +542,10 @@ static NTSTATUS fetch_group_info_to_ldif(TALLOC_CTX *mem_ctx,
groupmap->sambaSID = talloc_asprintf(mem_ctx, "%s-%d", sid, g_rid);
groupmap->group_dn = talloc_asprintf(mem_ctx,
"cn=%s,ou=%s,%s", groupname, group_attr, suffix);
- NT_STATUS_HAVE_NO_MEMORY(groupmap->sambaSID);
- NT_STATUS_HAVE_NO_MEMORY(groupmap->group_dn);
+ if (groupmap->sambaSID == NULL || groupmap->group_dn == NULL) {
+ SAFE_FREE(group_attr);
+ return NT_STATUS_NO_MEMORY;
+ }
/* Write the data to the temporary add ldif file */
fprintf(add_fd, "# %s, %s, %s\n", groupname, group_attr,