From patchwork Tue Mar 20 02:46:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 10296019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9ED49602C2 for ; Tue, 20 Mar 2018 02:46:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EE782922E for ; Tue, 20 Mar 2018 02:46:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 836EA29233; Tue, 20 Mar 2018 02:46:36 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 8A4FB2922E for ; Tue, 20 Mar 2018 02:46:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B9D36E0AD; Tue, 20 Mar 2018 02:46:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7FFB56E0AD for ; Tue, 20 Mar 2018 02:46:30 +0000 (UTC) Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20180320024627epoutp04a8521207210e98d42af4206adbafce4c~dgOkfL1522822928229epoutp04Y; Tue, 20 Mar 2018 02:46:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20180320024627epoutp04a8521207210e98d42af4206adbafce4c~dgOkfL1522822928229epoutp04Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1521513987; bh=/iDIpEMPF1bN0PMRShM2zQObWDYcCvU7g+vE0ELxfWs=; h=From:To:Cc:Subject:Date:References:From; b=HisFgGBk1Pc5o2eEb9RoOXnY/abdhLoKI2s2z1ZQ05q79VwDGBzEs4RUOqycs3ZKH SHFyQsXl65ll1cs9wN1l20itO21VGhTaYRrrpZ/pSbRSvnlb5n/ZK60D3qdYBr0vOW DVzP7Y+G09SfR9t3VtOU/Q8yEdBk90J5jLwu81w0= Received: from epsmges2p1.samsung.com (unknown [182.195.40.68]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20180320024627epcas1p4e87a48138ef1c9c22b995333f817e282~dgOkIeUlW2501625016epcas1p4b; Tue, 20 Mar 2018 02:46:27 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 6F.A4.04131.30670BA5; Tue, 20 Mar 2018 11:46:27 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20180320024627epcas2p242077183d05863bd40a3840775e76fcc~dgOj3f-FV2135721357epcas2p2R; Tue, 20 Mar 2018 02:46:27 +0000 (GMT) X-AuditID: b6c32a45-3ebff70000001023-88-5ab0760351fd Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 1D.BC.03890.20670BA5; Tue, 20 Mar 2018 11:46:27 +0900 (KST) Received: from daeinki-desktop.tn.corp.samsungelectronics.net ([10.113.62.206]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P5V00J7XBPEWZC0@mmp2.samsung.com>; Tue, 20 Mar 2018 11:46:26 +0900 (KST) From: Inki Dae To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm] tests: fix memory leak issue Date: Tue, 20 Mar 2018 11:46:08 +0900 Message-id: <1521513968-19978-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLIsWRmVeSWpSXmKPExsWy7bCmhS5z2YYogz9LpC2ufH3PZjHp/gQW i9u/+RyYPe53H2fy6G1+x+bRt2UVYwBzVKpNRmpiSmqRQmpecn5KZl66rZJ3cLxzvKmZgaGu oaWFuZJCXmJuqq2Si0+ArltmDtAiJYWyxJxSoFBAYnGxkr6dTVF+aUmqQkZ+cYmtUrShoZGe oYG5npGRkZ6JcayVkSlQSUJqxpxDE5kKTnBUtE/ZzNzAOIm9i5GDQ0LARGL2NfkuRk4OIYEd jBLHtrp3MXIB2d8ZJY5+bWMHSYDU3Oi9yQSR2MAo8b1pLZQzkUli59ZnjCBVbAKqEhNX3GcD sUUElCX+TlwFFmcWMJf4+fI/2CRhoEmvL+xiBbFZgOrXPjoHZvMKuEj0/D3MCrFNTuLkscms IAskBA6yStzcBZNwkZjc9J8NwhaWeHV8C9R50hLPVm1khGhoZ5TYdfY6G4TTwyixfPEiqCpj iWcLu5ggTuKT6Dj8FxoAvBIdbUIQpofEvJYKiGpHiY+rZ7NCwiVWYtKlNrYJjJILGBlWMYql FhTnpqcWGxUY6hUn5haX5qXrJefnbmIER72W6w7GGed8DjEKcDAq8fBq3FkfJcSaWFZcmXuI UYKDWUmEVz16Q5QQb0piZVVqUX58UWlOavEhRlNgeExklhJNzgcmpLySeEMTSwMTMzMjczML YAIQ520LcIkSEkhPLEnNTk0tSC2C6WPi4JRqYNwQcC/b22Tjk+dHEqqWSAYoPiydZBTTIvtY boMt36lX624mRMj8TH/zQPhT8Zufr6x2zD11i2Gr/ukHhg5vp5hFTd0444CLLkPELUu/Oec6 bn9c0vJ45/KZbiKhoYsO/JLaXPie9YropWML9qib7HP6xchVp3BV8wMn06Qc3tdHIu4fZXr4 +U6bEktxRqKhFnNRcSIAfYjnMRADAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGJMWRmVeSWpSXmKPExsVy+t9jQV3msg1RBtNXsVpc+fqezWLS/Qks Frd/8zkwe9zvPs7k0dv8js2jb8sqxgDmKC6blNSczLLUIn27BK6MOYcmMhWc4Khon7KZuYFx EnsXIyeHhICJxI3em0xdjFwcQgLrGCX+r1nMBuFMZpJoO7iXDaSKTUBVYuKK+2C2iICyxN+J qxhBbGYBc4mfL/+DTRIGmvT6wi5WEJsFqH7to3NgNq+Ai0TP38OsENvkJE4em8w6gZFrASPD KkbJ1ILi3PTcYqMCo7zUcr3ixNzi0rx0veT83E2MQN9uO6zVv4Px8ZL4Q4wCHIxKPLwad9ZH CbEmlhVX5h5ilOBgVhLhVY/eECXEm5JYWZValB9fVJqTWnyIUZqDRUmclz//WKSQQHpiSWp2 ampBahFMlomDU6qBkf1tS8mcsx87hc8d4SvfyDjT9O4pj1tBu4NcWQ3890SuyNKT1J/99GTz xi7bRzN271wozsPJofPLTE7y80P2RbqchhoSiybOOcm30mZ78ZJriwRmPfNdMyvw9npevcqe pz7Xdq387VWo3tN+s3OPpHrak28c2d6L50pk8yr9/Na3P+HYVcFHdkosxRmJhlrMRcWJAJ5V ms7pAQAA X-CMS-MailID: 20180320024627epcas2p242077183d05863bd40a3840775e76fcc X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180320024627epcas2p242077183d05863bd40a3840775e76fcc X-RootMTR: 20180320024627epcas2p242077183d05863bd40a3840775e76fcc References: 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: treding@nvidia.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Fixed memory leak issue to drmModeRes object. This object was allocated by drmModeGetResources function but not freed when device->screens failed. So this patch frees the drmModeRes object when device->screens failed by calling drmModeFreeResources function. Signed-off-by: Inki Dae --- tests/kms/libkms-test-device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/kms/libkms-test-device.c b/tests/kms/libkms-test-device.c index 53c7349..8127aa7 100644 --- a/tests/kms/libkms-test-device.c +++ b/tests/kms/libkms-test-device.c @@ -112,7 +112,7 @@ static void kms_device_probe_crtcs(struct kms_device *device) device->crtcs = calloc(res->count_crtcs, sizeof(crtc)); if (!device->crtcs) - return; + goto err_free_resources; for (i = 0; i < res->count_crtcs; i++) { crtc = kms_crtc_create(device, res->crtcs[i]); @@ -123,6 +123,7 @@ static void kms_device_probe_crtcs(struct kms_device *device) device->num_crtcs++; } +err_free_resources: drmModeFreeResources(res); }