mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-03 13:28:44 +00:00
Check for calloc() failure in filesystem code
This commit is contained in:
1 parent
4593332204
commit
f015a8686e
3 files changed
+20
-16
No files matched your search
+4
-3
@@ -67,9 +67,10 @@ static void *packed_open(const char *path, int flags) {
|
||||
struct packed_file *fp = NULL;
|
||||
if (data == NULL) return NULL;
|
||||
if (flags & MG_FS_WRITE) return NULL;
|
||||
fp = (struct packed_file *) calloc(1, sizeof(*fp));
|
||||
fp->size = size;
|
||||
fp->data = data;
|
||||
if ((fp = (struct packed_file *) calloc(1, sizeof(*fp))) != NULL) {
|
||||
fp->size = size;
|
||||
fp->data = data;
|
||||
}
|
||||
return (void *) fp;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user