Check for memory allocation errors

This commit is contained in:
Miroslav Lichvar
2014-09-22 16:09:35 +02:00
parent bb16c81e7b
commit 336473398a
8 changed files with 93 additions and 21 deletions

View File

@@ -30,6 +30,7 @@
#include "sysincl.h"
#include "memory.h"
#include "mkdirpp.h"
static int
@@ -74,7 +75,7 @@ mkdir_and_parents(const char *path)
int i, j, k, last;
len = strlen(path);
p = (char *) malloc(1 + len);
p = (char *)Malloc(1 + len);
i = k = 0;
while (1) {
@@ -84,7 +85,7 @@ mkdir_and_parents(const char *path)
p[i] = 0;
if (do_dir(p) < 0) {
free(p);
Free(p);
return 0;
}
@@ -114,7 +115,7 @@ mkdir_and_parents(const char *path)
}
free(p);
Free(p);
return 1;
}