wg: check for malloc failure

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2017-04-19 16:51:24 +02:00
parent 755217bd85
commit 6a967c63a7

View file

@ -153,6 +153,10 @@ static inline bool parse_endpoint(struct sockaddr *endpoint, const char *value)
.ai_socktype = SOCK_DGRAM, .ai_socktype = SOCK_DGRAM,
.ai_protocol = IPPROTO_UDP .ai_protocol = IPPROTO_UDP
}; };
if (!mutable) {
perror("strdup");
return false;
}
if (!strlen(value)) { if (!strlen(value)) {
free(mutable); free(mutable);
fprintf(stderr, "Unable to parse empty endpoint\n"); fprintf(stderr, "Unable to parse empty endpoint\n");