From patchwork Wed Jul 3 11:50:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damijan Skvarc X-Patchwork-Id: 1126853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LDj+ngqi"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45dzvb4kjlz9s00 for ; Wed, 3 Jul 2019 21:50:50 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E8A36F34; Wed, 3 Jul 2019 11:50:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 91C67F30 for ; Wed, 3 Jul 2019 11:50:46 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E7C4670D for ; Wed, 3 Jul 2019 11:50:45 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id f17so2053167wme.2 for ; Wed, 03 Jul 2019 04:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=icJSC9nVXVCT2XXCYJaQZuoV26BtfWAJMkCce3JdYuU=; b=LDj+ngqiI6zZqNt9AzmtTMI4BlsAU0oXTn5ymo1k6qGsc9nZIoKQkM3xAuB69Hib/5 gSygUtN/ojniTgN4TYwXB+0+6DHIyR3zOse3o6ga9Yj4Xx0LIIYysNNN+D+YwtJoxy9h 1aAmyvrcikAjqflA8aa71jHgFwPp/rDgHne7BjSKX/T+jh422Z63Nn11DXhY0KYn7qgg 6LXEscrs0R7wetkUtFXj5RWGKwAjxWdQ6HzrOIU1u2/Akyc6/KwNsIwWgW6VUGUurYPQ GbM6MIgfcVWZCDZr0LGnVfemUcWd45/96Rxtl/JwgxfyS7ea/55tJ0hr4uR085kk2eD+ 9iKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=icJSC9nVXVCT2XXCYJaQZuoV26BtfWAJMkCce3JdYuU=; b=qjdmD5PJS08LtolH6oibx7Fbo+3bMHQnqVeR5niDBwN0lAIDomoa8ToeLmoxIz2n8C R0QofDoaIZXaiOQRwIrUah78T0iTpsoe0JNJ6jdmOX5WmhSLquI6guicCe2+0jfXrsKV vZIYOhmAe8QP7R1nK47iJ7Jp0EPT+xMmClHMLiQqYPJj27EZePwi2eG6VxdgwShdyWBt Sa6U2bAip4dkQZm+bDssVXU9Ver+xam9BJcSpNZWcTso8JsCnhMLwr2hAuyHXGltGT4E bb0IwwvO4lvDndYBdeZZZi+Le+RJiglmHP9A641QRu1pLE660FyWt2D0HrfrSDQ9/vru Lnxw== X-Gm-Message-State: APjAAAWNIx66l3XdmjWc3wjI2pfz152e7LRyVY5UndvetyNxZbRaDv/0 JRCym1RQ/vqI4bB37E48o0thtjZG X-Google-Smtp-Source: APXvYqyq8638h4zJKL9ySbcHwv5zpjj0wRfg4rbJit/+wPF6+gOwONM9kUiy+zYnyP8lIKMAao5tBg== X-Received: by 2002:a1c:a783:: with SMTP id q125mr8243228wme.94.1562154643929; Wed, 03 Jul 2019 04:50:43 -0700 (PDT) Received: from damijan-PC.i-tech.local (mail.i-tech.si. [89.212.78.105]) by smtp.gmail.com with ESMTPSA id k63sm2415470wmb.2.2019.07.03.04.50.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jul 2019 04:50:43 -0700 (PDT) From: Damijan Skvarc To: dev@openvswitch.org Date: Wed, 3 Jul 2019 13:50:40 +0200 Message-Id: <1562154640-31792-1-git-send-email-damjan.skvarc@gmail.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 1/1] ovn-nbctl: fix memory leak X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Patch is mostly intended to prevent valgrind to report memory leak issues while running unit tests. Otherwise it does not benefit anything since the application exits immediately after freeing the memory. Signed-off-by: Damijan Skvarc --- ovn/utilities/ovn-nbctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index e86ab7f..98a8faa 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -156,6 +156,7 @@ main(int argc, char *argv[]) char *error_s = ovs_cmdl_parse_all(argc, argv, get_all_options(), &parsed_options, &n_parsed_options); if (error_s) { + free(args); ctl_fatal("%s", error_s); } @@ -181,6 +182,7 @@ main(int argc, char *argv[]) bool daemon_mode = false; if (get_detach()) { if (argc != optind) { + free(args); ctl_fatal("non-option arguments not supported with --detach " "(use --help for help)"); } @@ -203,6 +205,7 @@ main(int argc, char *argv[]) error = ctl_parse_commands(argc - optind, argv + optind, &local_options, &commands, &n_commands); if (error) { + free(args); ctl_fatal("%s", error); } VLOG(ctl_might_write_to_db(commands, n_commands) ? VLL_INFO : VLL_DBG, @@ -212,11 +215,13 @@ main(int argc, char *argv[]) error = run_prerequisites(commands, n_commands, idl); if (error) { + free(args); ctl_fatal("%s", error); } error = main_loop(args, commands, n_commands, idl, NULL); if (error) { + free(args); ctl_fatal("%s", error); }