shithub: opus-tools

Download patch

ref: 350617f55d9154f2e95d65687a0a719483d745a7
parent: 8753ff35378dfac05272c2a087fcd32da95e3d04
author: Giacomo Vacca <giacomo.vacca@gmail.com>
date: Sun Jan 15 15:37:31 EST 2017

opusrtp::extract() - call pcap_close for any error condition

Signed-off-by: Ralph Giles <giles@thaumas.net>

--- a/src/opusrtp.c
+++ b/src/opusrtp.c
@@ -803,6 +803,7 @@
   params = malloc(sizeof(state));
   if (!params) {
     fprintf(stderr, "Couldn't allocate param struct.\n");
+    pcap_close(pcap);
     return -1;
   }
   params->linktype = pcap_datalink(pcap);
@@ -810,6 +811,7 @@
   if (!params->stream) {
     fprintf(stderr, "Couldn't allocate stream struct.\n");
     free(params);
+    pcap_close(pcap);
     return -1;
   }
   if (ogg_stream_init(params->stream, rand()) < 0) {
@@ -816,6 +818,7 @@
     fprintf(stderr, "Couldn't initialize Ogg stream state.\n");
     free(params->stream);
     free(params);
+    pcap_close(pcap);
     return -1;
   }
   params->out = fopen("rtpdump.opus", "wb");
@@ -823,6 +826,7 @@
     fprintf(stderr, "Couldn't open output file.\n");
     free(params->stream);
     free(params);
+    pcap_close(pcap);
     return -2;
   }
   params->seq = 0;