From patchwork Thu Jun 18 15:50:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 486363 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 992CD1401F0 for ; Fri, 19 Jun 2015 01:52:43 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=1A0XyOC4; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 72DDA28C111; Thu, 18 Jun 2015 17:51:32 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id C702228C0EA for ; Thu, 18 Jun 2015 17:51:02 +0200 (CEST) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 18 Jun 2015 17:50:57 +0200 (CEST) Received: by wicgi11 with SMTP id gi11so18129743wic.0 for ; Thu, 18 Jun 2015 08:51:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FLB9boopkfteGdM4bUiDY9/snXb8VAd62FxXKxhGciU=; b=1A0XyOC4mbS+mSfV7OWtMkqKyPj7C7UplNrWFuabz3f1qabLMM9F++BlW+hFh7VaTR XisTPYsMeo8RE504K52YIbzDsPyzV/dJhYBtx1xB7B8D1l2sDTuTQysVsqm9EY0izvu3 E0di8zbszKLr5kc4g8UsQjh4SLmfpWjBX/d3cLR86MOOHdN1BJuYWcxgaNoUl5fbAw5E 3vUB09DEpNVpR5ObkyPICYb/OtbUhEjnZv23M3DQRSDQs0X//MgULadOBBZHwhmTng/x l95zy3olPr/FgiMaJ+My6SE2h9rotec1UFZ8tg0f/etlFBX2mj8Z0e+t3yhcjl/S6qo4 B7Ng== X-Received: by 10.194.173.225 with SMTP id bn1mr7823615wjc.83.1434642662030; Thu, 18 Jun 2015 08:51:02 -0700 (PDT) Received: from orion.local ([5.2.198.78]) by mx.google.com with ESMTPSA id s8sm8625028wik.5.2015.06.18.08.51.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Jun 2015 08:51:01 -0700 (PDT) From: Alexandru Ardelean To: openwrt-devel@lists.openwrt.org Date: Thu, 18 Jun 2015 18:50:48 +0300 Message-Id: <1434642649-20330-3-git-send-email-ardeleanalex@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1434642649-20330-1-git-send-email-ardeleanalex@gmail.com> References: <1434642649-20330-1-git-send-email-ardeleanalex@gmail.com> Cc: Alexandru Ardelean Subject: [OpenWrt-Devel] [PATCH 3/4] swconfig: swlib.c: free portmaps in swlib_free() X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" From: Alexandru Ardelean Signed-off-by: Alexandru Ardelean --- package/network/config/swconfig/src/swlib.c | 13 +++++++++++++ package/network/config/swconfig/src/swlib.h | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package/network/config/swconfig/src/swlib.c b/package/network/config/swconfig/src/swlib.c index f74c093..1e0a7db 100644 --- a/package/network/config/swconfig/src/swlib.c +++ b/package/network/config/swconfig/src/swlib.c @@ -755,12 +755,25 @@ swlib_free_attributes(struct switch_attr **head) *head = NULL; } +static void +swlib_free_port_map(struct switch_dev *dev) +{ + int i; + if (!dev || !dev->maps) + return; + + for (i=0; i < dev->ports; i++) + free(dev->maps[i].segment); + free(dev->maps); +} + void swlib_free(struct switch_dev *dev) { swlib_free_attributes(&dev->ops); swlib_free_attributes(&dev->port_ops); swlib_free_attributes(&dev->vlan_ops); + swlib_free_port_map(dev); free(dev->name); free(dev->alias); free(dev); diff --git a/package/network/config/swconfig/src/swlib.h b/package/network/config/swconfig/src/swlib.h index 28bdd7f..2b42c14 100644 --- a/package/network/config/swconfig/src/swlib.h +++ b/package/network/config/swconfig/src/swlib.h @@ -158,7 +158,7 @@ struct switch_port { struct switch_portmap { unsigned int virt; - const char *segment; + char *segment; }; /**