All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] osd/erasurecode: Fix memory leak in jerasure_matrix_to_bitmatrix()
@ 2013-11-02  6:58 Xing Lin
  2013-11-02  7:03 ` Sage Weil
  0 siblings, 1 reply; 5+ messages in thread
From: Xing Lin @ 2013-11-02  6:58 UTC (permalink / raw)
  To: ceph-devel; +Cc: sage, xinglin

Free allocated memory before return because of NULL input

Signed-off-by: Xing Lin <xinglin@cs.utah.edu>
---
 src/osd/ErasureCodePluginJerasure/jerasure.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/osd/ErasureCodePluginJerasure/jerasure.c b/src/osd/ErasureCodePluginJerasure/jerasure.c
index 9efae02..1bb4b1d 100755
--- a/src/osd/ErasureCodePluginJerasure/jerasure.c
+++ b/src/osd/ErasureCodePluginJerasure/jerasure.c
@@ -276,7 +276,10 @@ int *jerasure_matrix_to_bitmatrix(int k, int m, int w, int *matrix)
   int rowelts, rowindex, colindex, elt, i, j, l, x;
 
   bitmatrix = talloc(int, k*m*w*w);
-  if (matrix == NULL) { return NULL; }
+  if (matrix == NULL) {
+    free(bitmatrix);
+    return NULL; 
+  }
 
   rowelts = k * w;
   rowindex = 0;
-- 
1.8.3.4 (Apple Git-47)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-04 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-02  6:58 [PATCH] osd/erasurecode: Fix memory leak in jerasure_matrix_to_bitmatrix() Xing Lin
2013-11-02  7:03 ` Sage Weil
2013-11-02  9:16   ` Loic Dachary
2013-11-04 10:44     ` philippe.raipin
2013-11-04 14:29       ` Loic Dachary

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.