Skip to content

Commit

Permalink
HDFS-16667. Use malloc for buffer allocation in uriparser2 (apache#4576)
Browse files Browse the repository at this point in the history
* Windows doesn't support variables for specifying
  the array size.
* This PR uses malloc to fix this issue.
  • Loading branch information
GauthamBanasandra authored Jul 20, 2022
1 parent e664f81 commit d07256a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d07256a

Please sign in to comment.