From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUO8e-0006S6-65 for qemu-devel@nongnu.org; Sun, 30 Mar 2014 18:23:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUO8X-0002Yb-U9 for qemu-devel@nongnu.org; Sun, 30 Mar 2014 18:23:36 -0400 Received: from toccata.ens-lyon.org ([140.77.166.68]:40606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUO8X-0002YP-O5 for qemu-devel@nongnu.org; Sun, 30 Mar 2014 18:23:29 -0400 From: Samuel Thibault Date: Mon, 31 Mar 2014 00:22:52 +0200 Message-Id: <1396218189-14422-2-git-send-email-samuel.thibault@ens-lyon.org> In-Reply-To: <1396218189-14422-1-git-send-email-samuel.thibault@ens-lyon.org> References: <1396218189-14422-1-git-send-email-samuel.thibault@ens-lyon.org> Subject: [Qemu-devel] [PATCH 01/18] slirp: goto bad in udp_input if sosendto fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Jan Kiszka , Samuel Thibault , Guillaume Subiron Before this patch, if sosendto fails, udp_input is executed as if the packet was sent. This could cause memory leak. This patch adds a goto bad to cut the execution of this function. Signed-off-by: Guillaume Subiron --- slirp/udp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/slirp/udp.c b/slirp/udp.c index 8cc6cb6..fd2446a 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -218,6 +218,7 @@ udp_input(register struct mbuf *m, int iphlen) *ip=save_ip; DEBUG_MISC((dfd,"udp tx errno = %d-%s\n",errno,strerror(errno))); icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno)); + goto bad; } m_free(so->so_m); /* used for ICMP if error on sorecvfrom */ -- 1.9.0