summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-06-28 01:21:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:19:02 -0500
commit49f6498a6f4efca5097e6338b14bcfe07a8261df (patch)
tree1ead62f3247a5293c04d96d6e6274ba7f193a046
parent67af7a8c4390fcf467f9dfcb932e05bb2ec214d3 (diff)
downloadsamba-49f6498a6f4efca5097e6338b14bcfe07a8261df.tar.gz
samba-49f6498a6f4efca5097e6338b14bcfe07a8261df.tar.bz2
samba-49f6498a6f4efca5097e6338b14bcfe07a8261df.zip
r16589: Fix Klocwork #1999. Although it should be impossible to
get duplicate OID's returned in the oids_out list it is still good programming practice to clear out a malloc'ed string before re-writing it (especially in a loop). Jeremy (This used to be commit ae02c05bfca46eb6a8ba25b124c18a358a759cb5)
-rw-r--r--source3/libads/ldap_schema.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source3/libads/ldap_schema.c b/source3/libads/ldap_schema.c
index 13a8ab0cb0..b65ff956ac 100644
--- a/source3/libads/ldap_schema.c
+++ b/source3/libads/ldap_schema.c
@@ -283,22 +283,27 @@ ADS_STATUS ads_check_posix_schema_mapping(ADS_STRUCT *ads, enum wb_posix_mapping
if (strequal(ADS_ATTR_RFC2307_UIDNUMBER_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_UIDNUMBER_OID, oids_out[i])) {
+ SAFE_FREE(ads->schema.posix_uidnumber_attr);
ads->schema.posix_uidnumber_attr = SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_GIDNUMBER_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_GIDNUMBER_OID, oids_out[i])) {
+ SAFE_FREE(ads->schema.posix_gidnumber_attr);
ads->schema.posix_gidnumber_attr = SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_HOMEDIR_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_HOMEDIR_OID, oids_out[i])) {
+ SAFE_FREE(ads->schema.posix_homedir_attr);
ads->schema.posix_homedir_attr = SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_SHELL_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_SHELL_OID, oids_out[i])) {
+ SAFE_FREE(ads->schema.posix_shell_attr);
ads->schema.posix_shell_attr = SMB_STRDUP(names_out[i]);
}
if (strequal(ADS_ATTR_RFC2307_GECOS_OID, oids_out[i]) ||
strequal(ADS_ATTR_SFU_GECOS_OID, oids_out[i])) {
+ SAFE_FREE(ads->schema.posix_gecos_attr);
ads->schema.posix_gecos_attr = SMB_STRDUP(names_out[i]);
}
}