From: Simon Ruderich Date: Sat, 7 Dec 2013 21:34:37 +0000 (+0100) Subject: tlsproxy.c: Use strdup() instead of malloc()/perror(). X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=fcd91ac82fbdebf0470a93b4677fe68dc1cc5e54;p=tlsproxy%2Ftlsproxy.git tlsproxy.c: Use strdup() instead of malloc()/perror(). --- diff --git a/src/tlsproxy.c b/src/tlsproxy.c index fa57064..9cca1ad 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -317,12 +317,11 @@ static void parse_arguments(int argc, char **argv) { memcpy(global_proxy_host, optarg, (size_t)(position - optarg)); global_proxy_host[position - optarg] = '\0'; - global_proxy_port = malloc(strlen(position + 1) + 1); + global_proxy_host = strdup(position + 1); if (global_proxy_port == NULL) { - perror("malloc()"); + perror("strdup()"); exit(EXIT_FAILURE); } - strcpy(global_proxy_port, position + 1); break; }