Removes a memory leak in dup.

This commit is contained in:
Andrea Mazzoleni 2013-06-08 16:00:05 +02:00
parent ca2da5178a
commit 8784a42016

12
dup.c
View file

@ -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);