HDFS-16667. Use malloc for buffer allocation in uriparser2 (#4576)

* Windows doesn't support variables for specifying
  the array size.
* This PR uses malloc to fix this issue.
This commit is contained in:
Gautham B A 2022-07-20 21:57:28 +05:30 committed by GitHub
parent e664f81ce7
commit d07256a96d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -71,9 +71,11 @@ static const char *copy_path(const UriPathSegmentA *ps, char **buffer) {
static int parse_int(const char *first, const char *after_last) {
const int size = after_last - first;
if (size) {
char buffer[size + 1];
char* buffer = (char*) malloc(size + 1);
memcpyz(buffer, first, size);
return atoi(buffer);
const int value = atoi(buffer);
free(buffer);
return value;
}
return 0;
}