X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fcommon%2Fsrc%2Frt_generic_static.c;h=eb887a9bfb74a233e2f68c25318688cb88e251af;hb=refs%2Fchanges%2F15%2F5115%2F2;hp=1d8d9ca244c18efd9cd43b102f45279fd94e9123;hpb=2efdde081e2d8d31ee65907a84d5623e819451e4;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/common/src/rt_generic_static.c b/src/rmr/common/src/rt_generic_static.c index 1d8d9ca..eb887a9 100644 --- a/src/rmr/common/src/rt_generic_static.c +++ b/src/rmr/common/src/rt_generic_static.c @@ -1218,10 +1218,11 @@ static route_table_t* rt_clone_space( uta_ctx_t* ctx, route_table_t* srt, route_ things.nalloc = 2048; things.nused = 0; things.things = (void **) malloc( sizeof( void * ) * things.nalloc ); - memset( things.things, 0, sizeof( sizeof( void * ) * things.nalloc ) ); things.names = (const char **) malloc( sizeof( char * ) * things.nalloc ); - memset( things.names, 0, sizeof( char * ) * things.nalloc ); - if( things.things == NULL ) { + if( things.things == NULL || things.names == NULL ){ + if( things.things != NULL) { free( things.things ); } + if( things.names != NULL) { free( things.names ); } + if( free_on_err ) { rmr_sym_free( nrt->hash ); free( nrt ); @@ -1230,6 +1231,8 @@ static route_table_t* rt_clone_space( uta_ctx_t* ctx, route_table_t* srt, route_ return nrt; } + memset( things.things, 0, sizeof( sizeof( void * ) * things.nalloc ) ); + memset( things.names, 0, sizeof( char * ) * things.nalloc ); sst = srt->hash; // convenience pointers (src symtab) nst = nrt->hash;