]> git-server-git.apps.pok.os.sepia.ceph.com Git - jerasure.git/commitdiff
jerasure.c: add check for result of malloc()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sun, 27 Apr 2014 16:54:21 +0000 (18:54 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sun, 27 Apr 2014 16:56:52 +0000 (18:56 +0200)
Add check for bitmatrix and return NULL if malloc failed.

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

index de54fcf183572ff0191152a168b0b89c2ed8b05e..a2bd3e73f454ded6c5545a030ef7ccf87ad9fd56 100644 (file)
@@ -276,6 +276,7 @@ int *jerasure_matrix_to_bitmatrix(int k, int m, int w, int *matrix)
   if (matrix == NULL) { return NULL; }
 
   bitmatrix = talloc(int, k*m*w*w);
+  if (!bitmatrix) return NULL;
 
   rowelts = k * w;
   rowindex = 0;