From patchwork Sat May 1 16:39:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12234857 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDC16C433ED for ; Sat, 1 May 2021 16:44:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A11A461446 for ; Sat, 1 May 2021 16:44:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231603AbhEAQpU (ORCPT ); Sat, 1 May 2021 12:45:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29789 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230522AbhEAQpS (ORCPT ); Sat, 1 May 2021 12:45:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619887467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vhDT7Bh13JALM+TbFZtbkNyHYjQBF4dsNLAer7QG+GM=; b=BmcCMw9cFKXmmT0aKjFxsuPQgoEtNG7P4+J9m9VuOszxhkDD1BGb0j9TxHojDqnu+tKhOX VgZsCJIAO/qu4e1LSo2vTHixBmZyUkEsjsiOgH46ztMQc0GhMpQuNDf04Ug3Q1Pt0najzB iWR5gSVguqJ3xD+nLTm7drZhB1NFvVQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-qIcYlbS1Peae5xmg7XnfUw-1; Sat, 01 May 2021 12:44:26 -0400 X-MC-Unique: qIcYlbS1Peae5xmg7XnfUw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4D00A107ACCA; Sat, 1 May 2021 16:44:25 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A35260BE5; Sat, 1 May 2021 16:44:24 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com Subject: [PATCH iproute2 1/2] dcb: fix return value on dcb_cmd_app_show Date: Sat, 1 May 2021 18:39:22 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com dcb_cmd_app_show() is supposed to return EINVAL if an incorrect argument is provided. Fixes: 8e9bed1493f5 ("dcb: Add a subtool for the DCB APP object") Signed-off-by: Andrea Claudi Reviewed-by: Petr Machata --- dcb/dcb_app.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index c4816bc2..28f40614 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -667,7 +667,7 @@ static int dcb_cmd_app_show(struct dcb *dcb, const char *dev, int argc, char **a out: close_json_object(); dcb_app_table_fini(&tab); - return 0; + return ret; } static int dcb_cmd_app_flush(struct dcb *dcb, const char *dev, int argc, char **argv) From patchwork Sat May 1 16:39:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 12234855 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7C1CC433B4 for ; Sat, 1 May 2021 16:44:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1C0A6108B for ; Sat, 1 May 2021 16:44:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231617AbhEAQpW (ORCPT ); Sat, 1 May 2021 12:45:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31607 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231517AbhEAQpT (ORCPT ); Sat, 1 May 2021 12:45:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619887469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Rva2vPRMRJrYfDyC9PlLYOn6p2k58ez3co1vvesl5o=; b=aTmUfKpTjqNKVeKY81pRFt5BQPj364Ij9wnw3BeIiJK3IsTzIpe2lT55JlUpy2HIF8to3l yJpVhC7JaSFIx2Miv/sARDh234o1bB44tsCQoUmCIft2nWi/HMJXEUK9tw56nKdICNHQ7R Fi2dcXgVhunyhCmB2aIQ1f4L3+5EV2M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-421-zMIPUWwBNSqDA8zzPanBzg-1; Sat, 01 May 2021 12:44:27 -0400 X-MC-Unique: zMIPUWwBNSqDA8zzPanBzg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6AEE01898298; Sat, 1 May 2021 16:44:26 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 969D660BE5; Sat, 1 May 2021 16:44:25 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com Subject: [PATCH iproute2 2/2] dcb: fix memory leak Date: Sat, 1 May 2021 18:39:23 +0200 Message-Id: <0d19dbb485632ecfbbc09e04e8151f7157e6960b.1619886883.git.aclaudi@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com main() dinamically allocates dcb, but when dcb_help() is called it returns without freeing it. Fix this using a goto, as it is already done in the same function. Fixes: 67033d1c1c8a ("Add skeleton of a new tool, dcb") Signed-off-by: Andrea Claudi Reviewed-by: Petr Machata --- dcb/dcb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dcb/dcb.c b/dcb/dcb.c index 64a9ef02..696f00e4 100644 --- a/dcb/dcb.c +++ b/dcb/dcb.c @@ -571,7 +571,8 @@ int main(int argc, char **argv) break; case 'h': dcb_help(); - return 0; + ret = EXIT_SUCCESS; + goto dcb_free; default: fprintf(stderr, "Unknown option.\n"); dcb_help();