|
@@ -1049,7 +1049,8 @@ static void htable_rpc_reload(rpc_t* rpc, void* c)
|
|
|
|
|
|
|
|
|
memcpy(&nht, ht, sizeof(ht_t));
|
|
|
- nht.entries = (ht_entry_t*)shm_malloc(nht.htsize*sizeof(ht_entry_t));
|
|
|
+ /* it's temporary operation - use system malloc */
|
|
|
+ nht.entries = (ht_entry_t*)malloc(nht.htsize*sizeof(ht_entry_t));
|
|
|
if(nht.entries == NULL)
|
|
|
{
|
|
|
ht_db_close_con();
|
|
@@ -1060,6 +1061,18 @@ static void htable_rpc_reload(rpc_t* rpc, void* c)
|
|
|
|
|
|
if(ht_db_load_table(&nht, &ht->dbtable, 0)<0)
|
|
|
{
|
|
|
+ /* free any entry set if it was a partial load */
|
|
|
+ for(i=0; i<nht.htsize; i++)
|
|
|
+ {
|
|
|
+ first = nht.entries[i].first;
|
|
|
+ while(first)
|
|
|
+ {
|
|
|
+ it = first;
|
|
|
+ first = first->next;
|
|
|
+ ht_cell_free(it);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ free(nht.entries);
|
|
|
ht_db_close_con();
|
|
|
rpc->fault(c, 500, "Mtree reload failed");
|
|
|
return;
|
|
@@ -1086,6 +1099,7 @@ static void htable_rpc_reload(rpc_t* rpc, void* c)
|
|
|
ht_cell_free(it);
|
|
|
}
|
|
|
}
|
|
|
+ free(nht.entries);
|
|
|
ht_db_close_con();
|
|
|
return;
|
|
|
}
|