Fix invalid "closedir(...)" on NULL ptr
This commit is contained in:
parent
81c1123b7f
commit
53b3974d58
1 changed files with 0 additions and 3 deletions
|
@ -232,8 +232,6 @@ int c_simple_http_helper_mkdir_tree(const char *path) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (errno == ENOENT) {
|
} else if (errno == ENOENT) {
|
||||||
// Directory doesn't exist, create dir tree.
|
// Directory doesn't exist, create dir tree.
|
||||||
closedir(dir_ptr);
|
|
||||||
|
|
||||||
size_t buf_size = strlen(path) + 1;
|
size_t buf_size = strlen(path) + 1;
|
||||||
char *buf = malloc(buf_size);
|
char *buf = malloc(buf_size);
|
||||||
memcpy(buf, path, buf_size - 1);
|
memcpy(buf, path, buf_size - 1);
|
||||||
|
@ -256,7 +254,6 @@ int c_simple_http_helper_mkdir_tree(const char *path) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
// Other directory error.
|
// Other directory error.
|
||||||
closedir(dir_ptr);
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue