From: Stephen Seo Date: Thu, 7 Nov 2024 04:30:59 +0000 (+0900) Subject: Fix invalid "closedir(...)" on NULL ptr X-Git-Tag: 1.0~1 X-Git-Url: https://git.seodisparate.com/stephenseo/js/bootstrap.bundle.min.js?a=commitdiff_plain;h=53b3974d58196f10eac94f1873412fa031b2232c;p=c_simple_http Fix invalid "closedir(...)" on NULL ptr --- diff --git a/src/helpers.c b/src/helpers.c index c8b8cee..6a9bbc2 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -232,8 +232,6 @@ int c_simple_http_helper_mkdir_tree(const char *path) { return 1; } else if (errno == ENOENT) { // Directory doesn't exist, create dir tree. - closedir(dir_ptr); - size_t buf_size = strlen(path) + 1; char *buf = malloc(buf_size); memcpy(buf, path, buf_size - 1); @@ -256,7 +254,6 @@ int c_simple_http_helper_mkdir_tree(const char *path) { return 0; } else { // Other directory error. - closedir(dir_ptr); return 2; } }