1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-17 02:05:21 +03:00

r19075: Fix a potential NULL dereference

(This used to be commit 0ab5d7692c2c0fe798a067866cb236ea9c304463)
This commit is contained in:
Volker Lendecke 2006-10-04 20:15:23 +00:00 committed by Gerald (Jerry) Carter
parent 638a16900c
commit 38c4955c2a

View File

@ -674,6 +674,7 @@ static struct ldb_dn_component ldb_dn_copy_component(void *mem_ctx, struct ldb_d
dst.name = talloc_strdup(mem_ctx, src->name); dst.name = talloc_strdup(mem_ctx, src->name);
if (dst.name == NULL) { if (dst.name == NULL) {
talloc_free(dst.value.data); talloc_free(dst.value.data);
dst.value.data = NULL;
} }
return dst; return dst;
@ -826,6 +827,9 @@ struct ldb_dn *ldb_dn_compose(void *mem_ctx, const struct ldb_dn *dn1, const str
for (i = 0; i < dn1->comp_num; i++) { for (i = 0; i < dn1->comp_num; i++) {
newdn->components[i] = ldb_dn_copy_component(newdn->components, newdn->components[i] = ldb_dn_copy_component(newdn->components,
&(dn1->components[i])); &(dn1->components[i]));
if (newdn->components[i].value.data == NULL) {
goto failed;
}
} }
return newdn; return newdn;