Fix memory leak in secure channel.
authorBen Pfaff <blp@nicira.com>
Mon, 5 May 2008 21:44:24 +0000 (14:44 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 5 May 2008 23:06:56 +0000 (16:06 -0700)
Thanks to Reid for noticing and helping to track down this leak.

secchan/secchan.c

index 8ac3d41..25bd794 100644 (file)
@@ -221,10 +221,12 @@ relay_run(struct relay *r)
             if (this->rxbuf) {
                 int retval = rconn_send(peer->rconn, this->rxbuf);
                 if (retval != EAGAIN) {
-                    this->rxbuf = NULL;
                     if (!retval) {
                         progress = true;
+                    } else {
+                        buffer_delete(this->rxbuf);
                     }
+                    this->rxbuf = NULL;
                 }
             }
         }