diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-11-25 17:07:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:16:07 -0500 |
commit | ca3300cbd14d93f7bb9b43e813a2bc4f9f9cc7d3 (patch) | |
tree | ca6509617819c4d6aaeffec9130505dc4ec9345a /source3/lib/ldb/common/ldb_dn.c | |
parent | f6dece8b4d651560ba72ea7efbc665d53aba64eb (diff) | |
download | samba-ca3300cbd14d93f7bb9b43e813a2bc4f9f9cc7d3.tar.gz samba-ca3300cbd14d93f7bb9b43e813a2bc4f9f9cc7d3.tar.bz2 samba-ca3300cbd14d93f7bb9b43e813a2bc4f9f9cc7d3.zip |
r19898: Fix klokwork ids 3127, 3128, 3129, 3130
(This used to be commit 3250d20d27d4f85421052e877077526975b16e02)
Diffstat (limited to 'source3/lib/ldb/common/ldb_dn.c')
-rw-r--r-- | source3/lib/ldb/common/ldb_dn.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/lib/ldb/common/ldb_dn.c b/source3/lib/ldb/common/ldb_dn.c index 48f471bf6f..7a1d8a910b 100644 --- a/source3/lib/ldb/common/ldb_dn.c +++ b/source3/lib/ldb/common/ldb_dn.c @@ -441,7 +441,9 @@ struct ldb_dn *ldb_dn_explode_or_special(void *mem_ctx, const char *dn) */ /* Allocate a structure to hold the exploded DN */ - edn = ldb_dn_new(mem_ctx); + if (!(edn = ldb_dn_new(mem_ctx))) { + return NULL; + } edn->comp_num = 1; edn->components = talloc(edn, struct ldb_dn_component); @@ -713,7 +715,10 @@ struct ldb_dn *ldb_dn_copy_rebase(void *mem_ctx, const struct ldb_dn *old, const } offset = old->comp_num - old_base->comp_num; - new_dn = ldb_dn_copy_partial(mem_ctx, new_base, offset + new_base->comp_num); + if (!(new_dn = ldb_dn_copy_partial(mem_ctx, new_base, + offset + new_base->comp_num))) { + return NULL; + } for (i = 0; i < offset; i++) { new_dn->components[i] = ldb_dn_copy_component(new_dn->components, &(old->components[i])); } @@ -815,6 +820,7 @@ struct ldb_dn *ldb_dn_build_child(void *mem_ctx, const char *attr, newdn->comp_num = 1; newdn->components = talloc_array(newdn, struct ldb_dn_component, newdn->comp_num); + LDB_DN_NULL_FAILED(newdn->components); } newdn->components[0].name = talloc_strdup(newdn->components, attr); @@ -847,6 +853,7 @@ struct ldb_dn *ldb_dn_compose(void *mem_ctx, const struct ldb_dn *dn1, const str newdn->comp_num = dn1->comp_num; newdn->components = talloc_array(newdn, struct ldb_dn_component, newdn->comp_num); + LDB_DN_NULL_FAILED(newdn->components); } else { int comp_num = dn2->comp_num; if (dn1 != NULL) comp_num += dn1->comp_num; |