diff options
author | Curl Upstream <curl-library@cool.haxx.se> | 2021-05-26 06:18:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-05-27 19:11:35 (GMT) |
commit | 18b2a8d7604f3aced9c93220806851f96e231f36 (patch) | |
tree | 5a79eb90691de68ebfb91ac85d7e8faea3190a4d /lib/curl_path.c | |
parent | 076b3219f58ca16afa52fe095019a05537ade0f3 (diff) | |
download | CMake-18b2a8d7604f3aced9c93220806851f96e231f36.zip CMake-18b2a8d7604f3aced9c93220806851f96e231f36.tar.gz CMake-18b2a8d7604f3aced9c93220806851f96e231f36.tar.bz2 |
curl 2021-05-26 (6b951a69)
Code extracted from:
https://github.com/curl/curl.git
at commit 6b951a6928811507d493303b2878e848c077b471 (curl-7_77_0).
Diffstat (limited to 'lib/curl_path.c')
-rw-r--r-- | lib/curl_path.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/curl_path.c b/lib/curl_path.c index 6100d77..6510618 100644 --- a/lib/curl_path.c +++ b/lib/curl_path.c @@ -48,7 +48,7 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data, /* Check for /~/, indicating relative to the user's home directory */ if(data->conn->handler->protocol & CURLPROTO_SCP) { real_path = malloc(working_path_len + 1); - if(real_path == NULL) { + if(!real_path) { free(working_path); return CURLE_OUT_OF_MEMORY; } @@ -62,7 +62,7 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data, if((working_path_len > 1) && (working_path[1] == '~')) { size_t homelen = strlen(homedir); real_path = malloc(homelen + working_path_len + 1); - if(real_path == NULL) { + if(!real_path) { free(working_path); return CURLE_OUT_OF_MEMORY; } @@ -78,7 +78,7 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data, } else { real_path = malloc(working_path_len + 1); - if(real_path == NULL) { + if(!real_path) { free(working_path); return CURLE_OUT_OF_MEMORY; } @@ -130,7 +130,7 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir) /* Allocate enough space for home directory and filename + separator */ fullPathLength = strlen(cp) + strlen(homedir) + 2; *path = malloc(fullPathLength); - if(*path == NULL) + if(!*path) return CURLE_OUT_OF_MEMORY; /* Check for quoted filenames */ @@ -169,7 +169,7 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir) else { /* Read to end of filename - either to whitespace or terminator */ end = strpbrk(cp, WHITESPACE); - if(end == NULL) + if(!end) end = strchr(cp, '\0'); /* return pointer to second parameter if it exists */ *cpp = end + strspn(end, WHITESPACE); |