From patchwork Fri May 3 14:24:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 10928855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EE2A933 for ; Fri, 3 May 2019 14:25:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 900B1268AE for ; Fri, 3 May 2019 14:25:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83D67277D9; Fri, 3 May 2019 14:25:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24D1A268AE for ; Fri, 3 May 2019 14:25:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727282AbfECOZH (ORCPT ); Fri, 3 May 2019 10:25:07 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34366 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbfECOZH (ORCPT ); Fri, 3 May 2019 10:25:07 -0400 Received: by mail-wr1-f68.google.com with SMTP id e9so8170725wrc.1 for ; Fri, 03 May 2019 07:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=abRt0S8GkhmxX2/w0EriIhnTYGMeNKKlNYchu6w+GHA=; b=nEOf2CJcOUxd4wAFyFHANMm+++SUgfkPsoC04dNSW3Whfr525pfmwCLfYraJdkCFJ9 TW1FQFq7rPmvjCofWm+MPbMtc3Pi1m8dsOpGglognxpX3PLQheu2cslb31zmRLHoOg8z FO2Ml2uhLai72LU51rIZ89Ub262o0DNwul6weko1xcNZsR+aX8y0A6kcd6p1ZlvtzD13 U1m2nbfj83E3dAbntGhnFr3U6aq7RLCnyH/MQq+QLT0Q6b9rEn2fNJc0c7meIQOx1egr 01zkPqc6ysHZt/kczYdT+ze1pT8gVbC1Tod2wjYdRSCt9l6MhHqtAQ06561gkdtC9lJT CtqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=abRt0S8GkhmxX2/w0EriIhnTYGMeNKKlNYchu6w+GHA=; b=YE64MNegQhVDB+u91wNyy3MPfgNqIzbPXItZSEbEsOO1+KGIfFgeyc32xpwoK+kCHG n2+UIAgy7pPl6xmKfK+FsmJNvx9sHtLfxp2pPgFVlMduSj6TFv9pMoQUCZnhsNUTg2+q 5Q5Q+rt6yAArx0qEuSvoEwakx52W/olx9bepbUUGZu4jPnfmLIHR/Mwovx+auN+T868O UL0s2wZN0e+d8Xdbr90/LWCGz60B4+Vq2m+sHvN0QfgV6vA397vc7jBfV8fjr1mQ4h4q z+JVEvA/yGULSBu0Ndr3SCxOnjFK/NS9Js/ZkS6hpAcuSDKBHdSdH01aWt2tDy4az+cW 4Iiw== X-Gm-Message-State: APjAAAXkGd8ddT1S7++oMhozNE/dfIu3fqdd3zl5QveMVuE57HLTIvuf +VGa8Fq0XJeebDgqNk+iD9FyUjtW X-Google-Smtp-Source: APXvYqxvWnTquJlsfx5gh4DT9JAaFjCPlp+zdNr/HOOHitzxffPKedFPhMrwggzeelc1nNiZH6tLDQ== X-Received: by 2002:a5d:608f:: with SMTP id w15mr6693070wrt.74.1556893505905; Fri, 03 May 2019 07:25:05 -0700 (PDT) Received: from planxty.redhat.com ([2a02:8108:1700:1960:91dd:e2f9:ed05:ee2b]) by smtp.gmail.com with ESMTPSA id u2sm4497513wru.36.2019.05.03.07.25.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 03 May 2019 07:25:04 -0700 (PDT) From: John Kacur To: linux-trace-devel@vger.kernel.org Cc: Clark Williams , Steven Rostedt , John Kacur Subject: [PATCH] trace-cmd-listen: Fix resource leak of msg_handle Date: Fri, 3 May 2019 16:24:49 +0200 Message-Id: <20190503142449.9936-1-jkacur@redhat.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix the potential resource leak of msg_handle by calling tracecmd_msg_handle_close before returning in an error path Signed-off-by: John Kacur --- tracecmd/trace-listen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tracecmd/trace-listen.c b/tracecmd/trace-listen.c index 8bd7badb50e1..3106022eeb39 100644 --- a/tracecmd/trace-listen.c +++ b/tracecmd/trace-listen.c @@ -761,6 +761,7 @@ static int do_connection(int cfd, struct sockaddr_storage *peer_addr, plog("Error with getnameinfo: %s\n", gai_strerror(s)); close(cfd); + tracecmd_msg_handle_close(msg_handle); return -1; }