Mercurial > trustbridge
comparison common/listutil.c @ 61:b8cd573bd3ac
Fix check for malloc result, found by cppcheck.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Tue, 18 Mar 2014 14:05:17 +0100 |
parents | 3f6378647371 |
children | 4f79cf993737 |
comparison
equal
deleted
inserted
replaced
60:6acb1dae6185 | 61:b8cd573bd3ac |
---|---|
69 fclose(f); | 69 fclose(f); |
70 return READ_FILE_TOO_LARGE; | 70 return READ_FILE_TOO_LARGE; |
71 } | 71 } |
72 | 72 |
73 *data = (char *) malloc( *size + 1 ); | 73 *data = (char *) malloc( *size + 1 ); |
74 if (data == NULL) { | 74 if (*data == NULL) { |
75 fclose(f); | 75 fclose(f); |
76 return READ_FILE_NO_MEMORY; | 76 return READ_FILE_NO_MEMORY; |
77 } | 77 } |
78 | 78 |
79 if (fread(*data, 1, *size, f) != *size) { | 79 if (fread(*data, 1, *size, f) != *size) { |