From: Philippe Waroquiers Date: Mon, 15 Sep 2014 20:20:24 +0000 (+0000) Subject: Fix leak that can happen in case of IO error between V gdbsrv and vgdb. X-Git-Tag: svn/VALGRIND_3_11_0~991 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62a1b2529bbc93f4aab370906bfc92a146d006f0;p=thirdparty%2Fvalgrind.git Fix leak that can happen in case of IO error between V gdbsrv and vgdb. Spotted by Florian Krohm/IBM BEAM checker git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14541 --- diff --git a/coregrind/m_gdbserver/remote-utils.c b/coregrind/m_gdbserver/remote-utils.c index 1b9ce76bc6..56c8617fbd 100644 --- a/coregrind/m_gdbserver/remote-utils.c +++ b/coregrind/m_gdbserver/remote-utils.c @@ -836,6 +836,7 @@ int putpkt_binary (char *buf, int cnt) /* we might have to write a pkt when out FIFO not yet/anymore opened */ if (!ensure_write_remote_desc()) { warning ("putpkt(write) error: no write_remote_desc\n"); + free (buf2); return -1; } @@ -845,6 +846,7 @@ int putpkt_binary (char *buf, int cnt) do { if (VG_(write) (write_remote_desc, buf2, p - buf2) != p - buf2) { warning ("putpkt(write) error\n"); + free (buf2); return -1; }