[multicat-devel] [Git][videolan/multicat][master] fix memory leaks
Massiot
gitlab at videolan.org
Fri Apr 21 16:38:23 CEST 2017
Massiot pushed to branch master at videolan / multicat
Commits:
0a8b069f by Christophe Massiot at 2017-04-21T16:37:38+02:00
fix memory leaks
- - - - -
2 changed files:
- multicat.c
- util.c
Changes:
=====================================
multicat.c
=====================================
--- a/multicat.c
+++ b/multicat.c
@@ -1288,6 +1288,7 @@ dropped_packet:
}
free(pi_pid_cc_table);
+ free(p_buffer);
pf_ExitRead();
pf_ExitWrite();
=====================================
util.c
=====================================
--- a/util.c
+++ b/util.c
@@ -404,7 +404,11 @@ static struct addrinfo *ParseNodeService( char *_psz_string, char **ppsz_end,
struct in_addr addr;
if ( inet_aton( psz_node, &addr ) != 0 )
{
- struct sockaddr_in *p_sin = malloc( sizeof(struct sockaddr_in) );
+ uint8_t *p_buffer = malloc( sizeof(struct addrinfo) +
+ sizeof(struct sockaddr_in) );
+ p_res = (struct addrinfo *)p_buffer;
+ struct sockaddr_in *p_sin =
+ (struct sockaddr_in *)(p_buffer + sizeof(struct addrinfo));
p_sin->sin_family = AF_INET;
if ( psz_port != NULL )
p_sin->sin_port = ntohs( atoi( psz_port ) );
@@ -412,7 +416,6 @@ static struct addrinfo *ParseNodeService( char *_psz_string, char **ppsz_end,
p_sin->sin_port = 0;
p_sin->sin_addr = addr;
- p_res = malloc( sizeof(struct addrinfo) );
p_res->ai_family = AF_INET;
p_res->ai_socktype = SOCK_DGRAM;
p_res->ai_protocol = 0;
View it on GitLab: https://code.videolan.org/videolan/multicat/commit/0a8b069f892b0cd9d52ab913a2c77cad0f6bede6
More information about the multicat-devel
mailing list