From 029fba81c660f8a27f4b61f34ecb118f5018efda Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 22 Jul 2002 21:02:18 +0000 Subject: fix seg fault due to memory allocation goof. (This used to be commit 8e94f68a80bda0cbc989fb36466dfbc17a07079d) --- source3/registry/reg_frontend.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/registry') diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index 6e550c1a0d..d8a10940fd 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -304,6 +304,8 @@ int regval_ctr_addvalue( REGVAL_CTR *ctr, char *name, uint16 type, { len = strlen( name ); + /* allocate a slot in the array of pointers */ + if ( ctr->num_values == 0 ) ctr->values = talloc( ctr->ctx, sizeof(REGISTRY_VALUE*) ); else { @@ -312,6 +314,12 @@ int regval_ctr_addvalue( REGVAL_CTR *ctr, char *name, uint16 type, ctr->values = ppreg; } + /* allocate a new valuie and store the pointer in the arrya */ + + ctr->values[ctr->num_values] = talloc( ctr->ctx, sizeof(REGISTRY_VALUE) ); + + /* init the value */ + fstrcpy( ctr->values[ctr->num_values]->valuename, name ); ctr->values[ctr->num_values]->type = type; switch ( type ) -- cgit