jerasure.c: free memory before return in error case

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>
master
Danny Al-Gaaf 2014-03-22 21:58:53 +01:00
parent 4b6c76c659
commit b14af86424
1 changed files with 5 additions and 1 deletions

View 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