From patchwork Thu Oct 22 22:57:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Pettit X-Patchwork-Id: 534634 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 9277514131C for ; Fri, 23 Oct 2015 09:58:10 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id D7DA2109DB; Thu, 22 Oct 2015 15:57:55 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 462F5109C3 for ; Thu, 22 Oct 2015 15:57:53 -0700 (PDT) Received: from bar4.cudamail.com (bar2 [192.168.15.2]) by mx3v1.cudamail.com (Postfix) with ESMTP id DADB76182E3 for ; Thu, 22 Oct 2015 16:57:37 -0600 (MDT) X-ASG-Debug-ID: 1445554656-03dc210f8d1f2b50001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar4.cudamail.com with ESMTP id fDJNaszBCo8gBavZ (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 22 Oct 2015 16:57:37 -0600 (MDT) X-Barracuda-Envelope-From: jpettit@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO mail-pa0-f49.google.com) (209.85.220.49) by mx3-pf3.cudamail.com with ESMTPS (RC4-SHA encrypted); 22 Oct 2015 22:57:36 -0000 Received-SPF: unknown (mx3-pf3.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.49 Received: by padhk11 with SMTP id hk11so98846798pad.1 for ; Thu, 22 Oct 2015 15:57:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=GueCbbVLtWWs/AIn0RqgJ84Qej5AIZdNMD+oBCxxI3w=; b=kf1Wn6Iu29PyF455aGY9nfcl3RKROsHkVq/pjEbAJQK4cAalFX37ScrKXHGNdrOTyk bE6BoAMxDpBXYmNtl6/TlOEztPK/NYRHhoyX23s9za4Xc4nQWN5Qk8RUsrXL+e2iXYoW /6YDs3SDDOvqhbSC0QcMeebyArfousm4uh3qvdKIHv0LIO2l9A8MjvmkC/KJKd0Wuj4E upJVOsMP37zAOkzP1mXCEZ+1Do/GIgIQcddmcQaL9RDlp4rHRLcnyeTRIkc7hb2NWk0R LicPozEjPntJTn1ld/FZe86ys/fZDW28sFaJedGA0eetImOlGIfdD/I/Pv9oOBaWvlev UU9g== X-Gm-Message-State: ALoCoQk1r7I/t10VcBAl5Wjbf+ABNUdpMDzrcGDRC1scJ6/PQoeTn1AHWldZIGZJp8fsIqNLVHIa X-Received: by 10.68.248.6 with SMTP id yi6mr1150436pbc.158.1445554655808; Thu, 22 Oct 2015 15:57:35 -0700 (PDT) Received: from localhost.localdomain ([208.91.2.4]) by smtp.gmail.com with ESMTPSA id ve8sm15592685pbc.48.2015.10.22.15.57.34 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Oct 2015 15:57:35 -0700 (PDT) X-CudaMail-Envelope-Sender: jpettit@nicira.com X-Barracuda-Apparent-Source-IP: 208.91.2.4 From: Justin Pettit To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-1021070474 X-CudaMail-DTE: 102215 X-CudaMail-Originating-IP: 209.85.220.49 Date: Thu, 22 Oct 2015 15:57:25 -0700 X-ASG-Orig-Subj: [##CM-V3-1021070474##][PATCH 1/6] tnl-ports: Free "ip_dev" on error. Message-Id: <1445554650-21984-1-git-send-email-jpettit@nicira.com> X-Mailer: git-send-email 1.7.5.4 X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1445554657 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH 1/6] tnl-ports: Free "ip_dev" on error. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Justin Pettit Acked-by: Andy Zhou Acked-by: Andy Zhou --- lib/tnl-ports.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c index c82f018..77cf5bb 100644 --- a/lib/tnl-ports.c +++ b/lib/tnl-ports.c @@ -364,11 +364,13 @@ insert_ipdev(const char dev_name[]) ip_dev->change_seq = netdev_get_change_seq(dev); error = netdev_get_etheraddr(ip_dev->dev, &ip_dev->mac); if (error) { + free(ip_dev); return; } error4 = netdev_get_in4(ip_dev->dev, (struct in_addr *)&ip_dev->addr4, NULL); error6 = netdev_get_in6(ip_dev->dev, &ip_dev->addr6); if (error4 && error6) { + free(ip_dev); return; } ovs_strlcpy(ip_dev->dev_name, netdev_get_name(dev), sizeof ip_dev->dev_name);