summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>2014-03-22 21:58:53 +0100
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>2014-04-22 20:52:07 +0200
commitb14af86424e3cb8c89c0f2fd2b856580e446fba4 (patch)
tree513e59abc5cd1aa36440cff59eec2838d0180bfb
parent4b6c76c659047e59f51904282a53ae7d9b2a0bb7 (diff)
downloadjerasure-b14af86424e3cb8c89c0f2fd2b856580e446fba4.tar.gz
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>
-rw-r--r--src/jerasure.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/jerasure.c b/src/jerasure.c
index d2af918..de54fcf 100644
--- a/src/jerasure.c
+++ b/src/jerasure.c
@@ -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