]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix leak that can happen in case of IO error between V gdbsrv and vgdb.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Mon, 15 Sep 2014 20:20:24 +0000 (20:20 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Mon, 15 Sep 2014 20:20:24 +0000 (20:20 +0000)
Spotted by Florian Krohm/IBM BEAM checker

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14541

coregrind/m_gdbserver/remote-utils.c

index 1b9ce76bc6cae14c10ac222202a7a7d735e69254..56c8617fbdd487c39330de6f31c39e7f04f05cb6 100644 (file)
@@ -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;
       }