From 8784a42016e8766b381e49d5094735e941a0556b Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 8 Jun 2013 16:00:05 +0200 Subject: [PATCH] Removes a memory leak in dup. --- dup.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dup.c b/dup.c index 141ca747..7d130889 100644 --- a/dup.c +++ b/dup.c @@ -104,17 +104,19 @@ void state_dup(struct snapraid_state* state) /* for each file */ for(j=disk->filelist;j!=0;j=j->next) { struct snapraid_file* file = j->data; - struct snapraid_hash* hash = hash_alloc(disk, file); + struct snapraid_hash* hash; tommy_hash_t hash32; - /* if no hash, skip it */ - if (!hash) - continue; - /* if empty, skip it */ if (file->size == 0) continue; + hash = hash_alloc(disk, file); + + /* if no hash, skip it */ + if (!hash) + continue; + hash32 = hash_hash(hash); struct snapraid_hash* dup = tommy_hashdyn_search(&hashset, hash_compare, hash->hash, hash32);