]> git-server-git.apps.pok.os.sepia.ceph.com Git - jerasure.git/commitdiff
jerasure.c: free memory before return in error case
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sat, 22 Mar 2014 20:58:53 +0000 (21:58 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 22 Apr 2014 18:52:07 +0000 (20:52 +0200)
Fix for Coverity issue from Ceph project:

CID 1093211 (#1 of 1): Resource leak (RESOURCE_LEAK)
 20. leaked_storage: Variable "ind_to_row" going out of scope leaks
 the storage it points to.

CID 1093212 (#1 of 1): Resource leak (RESOURCE_LEAK)
 20. leaked_storage: Variable "row_ids" going out of scope leaks the
 storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/jerasure.c

index d2af91889b2f8df20c705b753a0bcd57f16de54e..de54fcf183572ff0191152a168b0b89c2ed8b05e 100644 (file)
@@ -838,7 +838,11 @@ static int **jerasure_generate_decoding_schedule(int k, int m, int w, int *bitma
   row_ids = talloc(int, k+m);
   ind_to_row = talloc(int, k+m);
 
-  if (set_up_ids_for_scheduled_decoding(k, m, erasures, row_ids, ind_to_row) < 0) return NULL;
+  if (set_up_ids_for_scheduled_decoding(k, m, erasures, row_ids, ind_to_row) < 0) {
+    free(row_ids);
+    free(ind_to_row);
+    return NULL;
+  }
 
   /* Now, we're going to create one decoding matrix which is going to 
      decode everything with one call.  The hope is that the scheduler