From patchwork Thu Apr 25 09:50:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seung-Woo Kim X-Patchwork-Id: 10916515 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 1C720161F for ; Thu, 25 Apr 2019 09:49:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C86F2000A for ; Thu, 25 Apr 2019 09:49:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1F7928C20; Thu, 25 Apr 2019 09:49:20 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 75B5C2000A for ; Thu, 25 Apr 2019 09:49:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 46E9789216; Thu, 25 Apr 2019 09:49:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9BB1789216 for ; Thu, 25 Apr 2019 09:49:15 +0000 (UTC) Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190425094913epoutp032912a27c1434b3ac5564ebafc6549517~YrrKKo3BN1284512845epoutp039 for ; Thu, 25 Apr 2019 09:49:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190425094913epoutp032912a27c1434b3ac5564ebafc6549517~YrrKKo3BN1284512845epoutp039 Received: from epsmges1p1.samsung.com (unknown [182.195.40.153]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20190425094909epcas1p304702a3358455859745add0305e89ad5~YrrHJAKf90172901729epcas1p3u; Thu, 25 Apr 2019 09:49:09 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id C6.84.04139.E8281CC5; Thu, 25 Apr 2019 18:49:02 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20190425094901epcas1p45bda10bc32483b64a995d137b801caa8~Yrq-p1EQ10397003970epcas1p4-; Thu, 25 Apr 2019 09:49:01 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190425094901epsmtrp1e46474ef7cb9827200b7e83194795055~Yrq-mTk7b0092700927epsmtrp1f; Thu, 25 Apr 2019 09:49:01 +0000 (GMT) X-AuditID: b6c32a35-98bff7000000102b-21-5cc1828e31a9 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 3B.3A.03662.D8281CC5; Thu, 25 Apr 2019 18:49:01 +0900 (KST) Received: from localhost.localdomain (unknown [10.113.221.222]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190425094901epsmtip2abbcb0945639935875f717cbf808384d~Yrq-a7I1t2190621906epsmtip2n; Thu, 25 Apr 2019 09:49:01 +0000 (GMT) From: Seung-Woo Kim To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm] tests/libkms-test-plane: fix possbile memory leak Date: Thu, 25 Apr 2019 18:50:00 +0900 Message-Id: <1556185800-20098-1-git-send-email-sw0312.kim@samsung.com> X-Mailer: git-send-email 1.7.4.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMKsWRmVeSWpSXmKPExsWy7bCmvm5f08EYg3sXZCyufH3PZrHn6j0m ixmTX7I5MHvsnHWX3eN+93Emj74tqxgDmKOybTJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwM dQ0tLcyVFPISc1NtlVx8AnTdMnOANikplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1Jy CiwL9IoTc4tL89L1kvNzrQwNDIxMgQoTsjOerDvKWHCQreLtvUdsDYwbWbsYOTkkBEwkTq/9 wgJiCwnsYJRYf6qki5ELyP7EKLFzyXY2COcbo8SLG3/YYDper3nLBJHYyyix6kc/M4TzhVFi S9sZsFlsAjoS+5f8BtshIqAs8XfiKkYQmxmo+/Hi/UwgtrCAp8Smtk1g9SwCqhKXbnxhB7F5 BdwkjixZxwKxTUFiwb23YGdICNxklXjSMwHqDBeJP08nskPYwhKvjm+BsqUkXva3QdnVEtsn /GSHaO5glOhpb4Saaiyxf+lkoCs4gC7SlFi/Sx/iOD6Jd197WEHCEgK8Eh1tQhDVKhI7j05i gwhLSczaEAwR9pDY+XcqOyToYiXW39/DNIFRZhbCzAWMjKsYxVILinPTU4sNCwyRI2YTIzjB aJnuYJxyzucQowAHoxIPr0LkgRgh1sSy4srcQ4wSHMxKIrzqpgdjhHhTEiurUovy44tKc1KL DzGaAgNsIrOUaHI+MPnllcQbmhoZGxtbmBiamRoaKonzrndwjhESSE8sSc1OTS1ILYLpY+Lg lGpg7JCrb7//7A7Dtvj9B9YfP3Pt536xKr0Zx+Y+cKuy29KwYeXDq7pzfm7UfbHDLCL+GLfJ y7/VxVbXElcsZmq69mv58e5P71Y29Tb+nmp6l0lXb8EVEwnT9x8LdD9c6tVmSvLot3hnk8LW mVrZuTxw3gZe3f3Lmy4ef/316sQkjW3f9dlye6cyJCqxFGckGmoxFxUnAgCUm+CfRgMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHJMWRmVeSWpSXmKPExsWy7bCSvG5v08EYg4NNWhZXvr5ns9hz9R6T xYzJL9kcmD12zrrL7nG/+ziTR9+WVYwBzFFcNimpOZllqUX6dglcGU/WHWUsOMhW8fbeI7YG xo2sXYycHBICJhKv17xl6mLk4hAS2M0o0XCpkQkiISUx99t2xi5GDiBbWOLw4WKImk+MEttX HAerYRPQkdi/5DfYIBEBZYm/E1cxgtjMAmYSa6avBrOFBTwlNrVtYgGxWQRUJS7d+MIOYvMK uEkcWbKOBWKXgsSCe2/ZJjDyLGBkWMUomVpQnJueW2xYYJSXWq5XnJhbXJqXrpecn7uJERwK Wlo7GE+ciD/EKMDBqMTDqxB5IEaINbGsuDL3EKMEB7OSCK+66cEYId6UxMqq1KL8+KLSnNTi Q4zSHCxK4rzy+ccihQTSE0tSs1NTC1KLYLJMHJxSDYz8cZ82pS+7un/GLzWWL8KPjltYrFv9 cb9/+u/Qj02Prma2fTPyU+XrNRdRnawxJzZHvk5YaK9fqcm6c8vCYjOPuVxcaqSx53pBRGSU ZvP2tYkM3zPlSsy6K7nZOPXaeCO3H4hoi+Ka8WP71OwJ/Cov42Zddq391hMe0rkodVrAyjzX 5VopCUosxRmJhlrMRcWJAPXzZs8BAgAA X-CMS-MailID: 20190425094901epcas1p45bda10bc32483b64a995d137b801caa8 X-Msg-Generator: CA CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20190425094901epcas1p45bda10bc32483b64a995d137b801caa8 References: X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1556185753; bh=j1onwVrytWrNNeyhVhvUf4YLob+9BceDH/Pp1/d4a+g=; h=From:To:Cc:Subject:Date:References:From; b=XpmKcNnvF4+qm7Y7SowHK0h3L6FT9JxxL2E2c93HAagdyiAzqinawo42NdQZwP5mp 7FtP4MUmDo3Ovl0RentNAcdC3+t6PY5/b5vK0hfKbNfy+UPD3fb4CTt9aY8BXMVgLp eM+EvdQvwHLtQpfrtiO4dug06sl4kkkku5OfJWM0= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sw0312.kim@samsung.com, emil.l.velikov@gmail.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The pointer p aquired with drmModeGetPlane() is not free in error path. Fix possible memory leak by calling drmModeFreePlane() in the error path. Signed-off-by: Seung-Woo Kim Reviewed-by: Emil Velikov --- tests/kms/libkms-test-plane.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/tests/kms/libkms-test-plane.c b/tests/kms/libkms-test-plane.c index 6c40a3c..4cb2737 100644 --- a/tests/kms/libkms-test-plane.c +++ b/tests/kms/libkms-test-plane.c @@ -55,8 +55,10 @@ static int kms_plane_probe(struct kms_plane *plane) } plane->formats = calloc(p->count_formats, sizeof(uint32_t)); - if (!plane->formats) + if (!plane->formats) { + drmModeFreePlane(p); return -ENOMEM; + } for (i = 0; i < p->count_formats; i++) plane->formats[i] = p->formats[i];