summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-03-29 22:45:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:47 -0500
commite4c66fe4ca2fbc3099009c2efd5cc8f37ed3ec7e (patch)
treeff957d1836cbcd6de21cc714d3ef521a4c2c1c45
parentb84d06dae754ef2f637bc6549c63a5062afbbab6 (diff)
downloadsamba-e4c66fe4ca2fbc3099009c2efd5cc8f37ed3ec7e.tar.gz
samba-e4c66fe4ca2fbc3099009c2efd5cc8f37ed3ec7e.tar.bz2
samba-e4c66fe4ca2fbc3099009c2efd5cc8f37ed3ec7e.zip
r14766: Fix possible NULL deref. Coverity #254.
Jeremy. (This used to be commit e2e2d8b939dd425a97b36102c6a541e3cf6236ad)
-rw-r--r--source3/registry/reg_objects.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c
index 05567d561c..71c2e206c7 100644
--- a/source3/registry/reg_objects.c
+++ b/source3/registry/reg_objects.c
@@ -43,8 +43,6 @@
int regsubkey_ctr_addkey( REGSUBKEY_CTR *ctr, const char *keyname )
{
- char **pp;
-
if ( !keyname )
return ctr->num_subkeys;
@@ -55,12 +53,15 @@ int regsubkey_ctr_addkey( REGSUBKEY_CTR *ctr, const char *keyname )
/* allocate a space for the char* in the array */
- if ( ctr->subkeys == 0 )
- ctr->subkeys = TALLOC_P( ctr, char *);
- else {
- pp = TALLOC_REALLOC_ARRAY( ctr, ctr->subkeys, char *, ctr->num_subkeys+1);
- if ( pp )
- ctr->subkeys = pp;
+ if (ctr->subkeys == NULL) {
+ ctr->subkeys = TALLOC_P(ctr, char *);
+ } else {
+ ctr->subkeys = TALLOC_REALLOC_ARRAY(ctr, ctr->subkeys, char *, ctr->num_subkeys+1);
+ }
+
+ if (!ctr->subkeys) {
+ ctr->num_subkeys = 0;
+ return 0;
}
/* allocate the string and save it in the array */