From: Eric Blossom Date: Thu, 20 May 2010 03:06:26 +0000 (-0700) Subject: Identify memory leaks that occur on error conditions X-Git-Url: https://git.gag.com/?p=debian%2Fgnuradio;a=commitdiff_plain;h=99a39a4351ca250dcbeeface0ab7b9de6e301d49 Identify memory leaks that occur on error conditions --- diff --git a/gnuradio-core/src/lib/io/gr_udp_sink.cc b/gnuradio-core/src/lib/io/gr_udp_sink.cc index 2ee16b79..3084a848 100755 --- a/gnuradio-core/src/lib/io/gr_udp_sink.cc +++ b/gnuradio-core/src/lib/io/gr_udp_sink.cc @@ -221,6 +221,8 @@ void gr_udp_sink::connect( const char *host, unsigned short port ) hints.ai_protocol = IPPROTO_UDP; char port_str[12]; sprintf( port_str, "%d", port ); + + // FIXME leaks if report_error throws below int ret = getaddrinfo( host, port_str, &hints, &ip_dst ); if( ret != 0 ) report_error("gr_udp_source/getaddrinfo", diff --git a/gnuradio-core/src/lib/io/gr_udp_source.cc b/gnuradio-core/src/lib/io/gr_udp_source.cc index b1c25382..063cd7b5 100755 --- a/gnuradio-core/src/lib/io/gr_udp_source.cc +++ b/gnuradio-core/src/lib/io/gr_udp_source.cc @@ -128,11 +128,14 @@ gr_udp_source::gr_udp_source(size_t itemsize, const char *host, hints.ai_flags = AI_PASSIVE; char port_str[12]; sprintf( port_str, "%d", port ); + + // FIXME leaks if report_error throws below ret = getaddrinfo( host, port_str, &hints, &ip_src ); if( ret != 0 ) report_error("gr_udp_source/getaddrinfo", "can't initialize source socket" ); + // FIXME leaks if report_error throws below d_temp_buff = new char[d_payload_size]; // allow it to hold up to payload_size bytes // create socket