From: Victor Julien Date: Fri, 18 Oct 2013 18:09:09 +0000 (+0200) Subject: storage: fix and small optimization X-Git-Tag: suricata-2.0beta2~206 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84af1ee27715c2eb2b8e1dda7cc9eecb03ad1260;p=thirdparty%2Fsuricata.git storage: fix and small optimization --- diff --git a/src/util-storage.c b/src/util-storage.c index 6bf3603bf0..8a858fb78c 100644 --- a/src/util-storage.c +++ b/src/util-storage.c @@ -288,11 +288,11 @@ void StorageFreeById(Storage *storage, StorageEnum type, int id) #endif SCLogDebug("storage %p id %d", storage, id); - StorageMapping *map = &storage_map[type][id]; Storage *store = storage; if (store != NULL) { SCLogDebug("store %p", store); if (store[id] != NULL) { + StorageMapping *map = &storage_map[type][id]; map->Free(store[id]); store[id] = NULL; } @@ -314,8 +314,8 @@ void StorageFreeAll(Storage *storage, StorageEnum type) Storage *store = storage; int i; for (i = 0; i < storage_max_id[type]; i++) { - StorageMapping *map = &storage_map[type][i]; if (store[i] != NULL) { + StorageMapping *map = &storage_map[type][i]; map->Free(store[i]); store[i] = NULL; } @@ -338,14 +338,14 @@ void StorageFree(Storage **storage, StorageEnum type) Storage *store = *storage; int i; for (i = 0; i < storage_max_id[type]; i++) { - StorageMapping *map = &storage_map[type][i]; if (store[i] != NULL) { + StorageMapping *map = &storage_map[type][i]; map->Free(store[i]); store[i] = NULL; } } SCFree(*storage); - storage = NULL; + *storage = NULL; } #ifdef UNITTESTS