[vlc-commits] access_out: rist: fix mem leak

Sergio Ammirata git at videolan.org
Fri Dec 7 09:50:03 CET 2018


vlc | branch: master | Sergio Ammirata <sergio at ammirata.net> | Tue Nov 27 07:45:45 2018 -0500| [d22baf21918cd9186734668f31cb74cf5a92d3a5] | committer: Thomas Guillem

access_out: rist: fix mem leak

It occured when socket creation failed.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d22baf21918cd9186734668f31cb74cf5a92d3a5
---

 modules/access_output/rist.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/access_output/rist.c b/modules/access_output/rist.c
index de36a744c9..1e36b963c5 100644
--- a/modules/access_output/rist.c
+++ b/modules/access_output/rist.c
@@ -126,20 +126,25 @@ static struct rist_flow *rist_udp_transmitter(sout_access_out_t *p_access, char
     if (flow->fd_out < 0)
     {
         msg_Err( p_access, "cannot open output socket" );
-        return NULL;
+        goto fail;
     }
 
     flow->fd_rtcp = net_ConnectDgram(p_access, psz_dst_server, i_dst_port + 1, -1, IPPROTO_UDP );
     if (flow->fd_rtcp < 0)
     {
         msg_Err( p_access, "cannot open nack socket" );
-        return NULL;
+        goto fail;
     }
 
     populate_cname(flow->fd_rtcp, flow->cname);
     msg_Info(p_access, "our cname is %s", flow->cname);
 
     return flow;
+
+fail:
+    free(flow->buffer);
+    free(flow);
+    return NULL;
 }
 
 static void rist_retransmit(sout_access_out_t *p_access, struct rist_flow *flow, uint16_t seq)



More information about the vlc-commits mailing list