From patchwork Fri Jan 17 02:18:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 11338193 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E934139A for ; Fri, 17 Jan 2020 02:20:19 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF02720748 for ; Fri, 17 Jan 2020 02:20:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CDKER621" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF02720748 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579227617; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=i2QLzL4VG3hBiD1XViYP1LDddSYtjEbs7WM7vgqWLKM=; b=CDKER621Zl6gU7tV9jC34ASTZI0i2nSr/uNriSZ3L1xfrQAgjMljLO6y1FsG3byFMvzY52 yb7cMRHSD9s/4W1YR/83L3XB8GjbNfwvDxDz+YKURk5+ePv3630ex84ihvTckwa/v5BM4F wVrd7ArIpk01FNVaB3haYSzRjkzlUS4= 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-169-Fqag9Bs7Ph23soyt4TTYqA-1; Thu, 16 Jan 2020 21:18:52 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2FFE3800A02; Fri, 17 Jan 2020 02:18:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C4A087ECD; Fri, 17 Jan 2020 02:18:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BAE1718089CE; Fri, 17 Jan 2020 02:18:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00H2ISrY030606 for ; Thu, 16 Jan 2020 21:18:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4C4F960E3E; Fri, 17 Jan 2020 02:18:28 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3639E60C87; Fri, 17 Jan 2020 02:18:28 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 00H2IPiB017248; Thu, 16 Jan 2020 20:18:25 -0600 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 00H2IPn2017247; Thu, 16 Jan 2020 20:18:25 -0600 From: Benjamin Marzinski To: Christophe Varoqui Date: Thu, 16 Jan 2020 20:18:08 -0600 Message-Id: <1579227500-17196-4-git-send-email-bmarzins@redhat.com> In-Reply-To: <1579227500-17196-1-git-send-email-bmarzins@redhat.com> References: <1579227500-17196-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH 03/15] Fix leak in mpathpersist X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: Fqag9Bs7Ph23soyt4TTYqA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com If the persistent in command fails, the response buffer must be freed. Found by Coverity Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- mpathpersist/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mpathpersist/main.c b/mpathpersist/main.c index 278b8d51..920e686c 100644 --- a/mpathpersist/main.c +++ b/mpathpersist/main.c @@ -499,6 +499,7 @@ static int handle_args(int argc, char * argv[], int nline) if (ret != MPATH_PR_SUCCESS ) { fprintf (stderr, "Persistent Reserve IN command failed\n"); + free(resp); goto out_fd; }