From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42ED3A04DE; Fri, 30 Oct 2020 13:30:27 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 230D6C86A; Fri, 30 Oct 2020 13:30:26 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id 6DD2AC864 for ; Fri, 30 Oct 2020 13:30:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604061022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LO7y1RPLgzwz0Aml9exdnQpefam9s5dO0IY+LjugHUE=; b=NXSoalFXyv6mtKT9vTyGlSbKidccLB5kSHQEUV1gjscEdVAlUcHUMD/5wivVHc/BJWkDDX TMGFJCbbwOb6MNiKYWNP4t0bo9VddFfMwSrsvn8mvGFE+33/ZnKiLflNFA0w/2nsqYmtWO 0S+neygHhH2GhfZ4Y1iHePenL+WBpc4= Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-2-qE8zgkPPOxWHp_rOTvC8Ng-1; Fri, 30 Oct 2020 08:30:21 -0400 X-MC-Unique: qE8zgkPPOxWHp_rOTvC8Ng-1 Received: by mail-vs1-f72.google.com with SMTP id n126so1473778vsn.22 for ; Fri, 30 Oct 2020 05:30:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LO7y1RPLgzwz0Aml9exdnQpefam9s5dO0IY+LjugHUE=; b=aNdBv3/XmMbzrguhyodD8AFgbq/zHfXdX8tH/MCArXHyexhaTyWvcGR/eIuE0nS+8B Ve1aeMFjCQ6+hA9deGAHAu0axY1nYZ9K6UKMC3oIrDy0FNO87ENOeZSRWaJ8Ofa5PM89 bhZfTDJ7xPLkqcesCIQyHAUA8ppgYaXW6UCM0+N3681Yh2IM7T6e08SFW0pQfM28k68w fWi58TedKllOXbghXaYjwk9i4AWfw90KJSxu4QWDeZAa4rcUG41fYk1xMR/D7oOPWYbw 2rVzinndoAQ6J8YTFKf6d/WoGT2lL6VeB4afuX5+mhWECAPdesPjmWjfZQy6utVpRZ83 KJAA== X-Gm-Message-State: AOAM533jcHjLTSYjfYtWbGjGEEyHQL+M1ZemGQreEUel0rAh/5OtPf1O iBwrF056fVaQnJuVTsJvYdl5NAD3SiWT6ynjOkYbIN5Ddp1m04wBhgWqWc+Fv84D4OnwWjU7wOu lI//hTojiBJc0PxyfQ6g= X-Received: by 2002:a67:2fca:: with SMTP id v193mr7054505vsv.18.1604061020535; Fri, 30 Oct 2020 05:30:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9dQFEr4cCi427oMls95glq1WNlUweV953NJXNgz/7vG9q3fLmONW0nZZfSVytsYO2m6Ccq1Y1o7izFRLUHmU= X-Received: by 2002:a67:2fca:: with SMTP id v193mr7054490vsv.18.1604061020282; Fri, 30 Oct 2020 05:30:20 -0700 (PDT) MIME-Version: 1.0 References: <20200729083754.1044630-1-rory.sexton@intel.com> In-Reply-To: <20200729083754.1044630-1-rory.sexton@intel.com> From: David Marchand Date: Fri, 30 Oct 2020 13:30:08 +0100 Message-ID: To: Rory Sexton Cc: dev , David Hunt , "Kovacevic, Marko" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 1/1] examples/vm_power_manager: fix resource leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Jul 29, 2020 at 10:38 AM Rory Sexton wrote: > > Fix memory leak where variable oob_enable can go out of scope leaking > the storage it points to. > > Coverity issue: 337674 > Fixes: 95f648ff9ee ("examples/vm_power: make branch ratio threshold per core") > > Signed-off-by: Rory Sexton Acked-by: David Hunt Applied, thanks Rory. There is another issue in this code. Previous branches part of the 'b' option handling will break from the parsing loop and have the parse_args() function return the option index where it stopped. This should instead report a parsing error and have the app fail to initialise. Something like: diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index 75d5b5364f..2c394b60fc 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -194,7 +194,7 @@ parse_args(int argc, char **argv) "core-branch-ratio matrix - [%s]\n", optarg); free(oob_enable); - break; + return -1; } cnt = parse_branch_ratio(optarg, &branch_ratio); if (cnt < 0) { @@ -202,7 +202,7 @@ parse_args(int argc, char **argv) "core-branch-ratio matrix - [%s]\n", optarg); free(oob_enable); - break; + return -1; } if (branch_ratio <= 0.0 || branch_ratio > 100.0) { printf("invalid branch ratio specified\n"); Could you test this and send a followup patch? Thanks. -- David Marchand