]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
- Fix - exchange char* portBuf = malloc(6) to char* port_buf[6] - no need for malloc...
authorBenny Morgan <benny@zuragon.com>
Sun, 30 Jun 2013 19:50:58 +0000 (21:50 +0200)
committerAdam Sutton <dev@adamsutton.me.uk>
Thu, 11 Jul 2013 19:17:32 +0000 (20:17 +0100)
(cherry picked from commit 6fc536e01423bc132c6b97c94286375cb97044c3)

Conflicts:

src/tcp.c

src/tcp.c

index 5ccf1bacef45a9ac6e1c7bca55d7767c4543d370..c241eab342264e597c09dd8d23390e67265a99a2 100644 (file)
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -505,21 +505,20 @@ tcp_server_create(int port, tcp_server_callback_t *start, void *opaque)
   struct epoll_event e;
   tcp_server_t *ts;
   struct addrinfo hints, *res, *ressave, *use = NULL;
-  char *portBuf = (char*)malloc(6);
+  char port_buf[6];
   int one = 1;
   int zero = 0;
 
   memset(&e, 0, sizeof(e));
 
-  snprintf(portBuf, 6, "%d", port);
+  snprintf(port_buf, 6, "%d", port);
 
   memset(&hints, 0, sizeof(struct addrinfo));
   hints.ai_flags = AI_PASSIVE;
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
 
-  x = getaddrinfo(NULL, portBuf, &hints, &res);
-  free(portBuf);
+  x = getaddrinfo(NULL, port_buf, &hints, &res);
 
   if(x != 0)
     return NULL;