jerasure.c: fix memory leak in error case
Check matrix for NULL before call talloc(). CID 1093213 (#1 of 1): Resource leak (RESOURCE_LEAK) 4. leaked_storage: Variable "bitmatrix" going out of scope leaks the storage it points to. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>master
parent
9e6b3483a3
commit
6d8fbc8b81
|
@ -273,9 +273,10 @@ int *jerasure_matrix_to_bitmatrix(int k, int m, int w, int *matrix)
|
|||
int *bitmatrix;
|
||||
int rowelts, rowindex, colindex, elt, i, j, l, x;
|
||||
|
||||
bitmatrix = talloc(int, k*m*w*w);
|
||||
if (matrix == NULL) { return NULL; }
|
||||
|
||||
bitmatrix = talloc(int, k*m*w*w);
|
||||
|
||||
rowelts = k * w;
|
||||
rowindex = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue