summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2006-03-10 13:33:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:13 -0500
commita2d489c187792cb18685830a8c80dd5bfed6163e (patch)
tree6df7ef9ab99774f869b309dd2422d05017780b66 /source3/utils
parentc34e73cfcf29462de597edf9c96435f38635f7f9 (diff)
downloadsamba-a2d489c187792cb18685830a8c80dd5bfed6163e.tar.gz
samba-a2d489c187792cb18685830a8c80dd5bfed6163e.tar.bz2
samba-a2d489c187792cb18685830a8c80dd5bfed6163e.zip
r14147: Fix coverity #119. alloc'ed memory returned not saved, so not freed.
Need to go back and correct the assumption that an "ldap xxx suffix" parm must have an OU. (This used to be commit 2d7ba11ffbe17af12257a91638be95d09c0c34c5)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_rpc_samsync.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index e31525b2ea..5ee0b70278 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -1076,11 +1076,15 @@ static NTSTATUS populate_ldap_for_ldif(fstring sid, const char *suffix, const ch
if (machine_suffix && *machine_suffix &&
strcmp(machine_suffix, user_suffix) &&
strcmp(machine_suffix, suffix)) {
- fprintf(add_fd, "# %s\n", lp_ldap_machine_suffix());
- fprintf(add_fd, "dn: %s\n", lp_ldap_machine_suffix());
+ char *machine_ou = NULL;
+ fprintf(add_fd, "# %s\n", machine_suffix);
+ fprintf(add_fd, "dn: %s\n", machine_suffix);
fprintf(add_fd, "objectClass: organizationalUnit\n");
- fprintf(add_fd, "ou: %s\n",
- sstring_sub(lp_ldap_machine_suffix(), '=', ','));
+ /* this isn't totally correct as it assumes that
+ there _must_ be an ou. just fixing memleak now. jmcd */
+ machine_ou = sstring_sub(lp_ldap_machine_suffix(), '=', ',');
+ fprintf(add_fd, "ou: %s\n", machine_ou);
+ SAFE_FREE(machine_ou);
fprintf(add_fd, "\n");
fflush(add_fd);
}