From: Qiang Yu <Qiang.Yu@amd.com>
To: amd-gfx@lists.freedesktop.org
Cc: Qiang Yu <Qiang.Yu@amd.com>,
Emil Velikov <emil.l.velikov@gmail.com>,
dri-devel@lists.freedesktop.org
Subject: [libdrm][PATCH v2 2/2] drm: fix multi GPU drmFreeDevices memory leak
Date: Thu, 14 Jul 2016 17:10:56 +0800 [thread overview]
Message-ID: <1468487456-28666-2-git-send-email-Qiang.Yu@amd.com> (raw)
In-Reply-To: <1468487456-28666-1-git-send-email-Qiang.Yu@amd.com>
When in multi GPU case, devices array may have some
NULL "hole" in between two devices. So check all
array elements and free non-NULL device.
Change-Id: Ifc32d240f895059bc4b19138cb81de38d99fb88a
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
---
xf86drm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/xf86drm.c b/xf86drm.c
index 19001db..32bedeb 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2992,8 +2992,9 @@ void drmFreeDevices(drmDevicePtr devices[], int count)
if (devices == NULL)
return;
- for (i = 0; i < count && devices[i] != NULL; i++)
- drmFreeDevice(&devices[i]);
+ for (i = 0; i < count; i++)
+ if (devices[i])
+ drmFreeDevice(&devices[i]);
}
static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-07-14 9:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 9:10 [libdrm][PATCH v2 1/2] drm: Fix multi GPU drmGetDevice return wrong device Qiang Yu
2016-07-14 9:10 ` Qiang Yu [this message]
2016-07-14 17:20 ` Emil Velikov
2016-07-15 1:19 ` Yu, Qiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1468487456-28666-2-git-send-email-Qiang.Yu@amd.com \
--to=qiang.yu@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox