Tilman,
I'm copying this patch to the dri-devel list. I'd like to get some confirmation of the patch before I apply it. (I applied the other three). Can someone take a look at this?
In the future DRI-related patches should probably be sent to the dri-devel list.
-Brian
Tilman Sauerbeck wrote:
Hi, the attached patch fixes a memleak in drmMapBufs() resp. in drmUnmapBufs()
Applies to CVS, too.
------------------------------------------------------------------------
diff -Naur xc.orig/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
--- xc.orig/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c 2004-03-04 18:48:09.000000000 +0100
+++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c 2004-04-23 23:40:57.000000000 +0200
@@ -1055,7 +1055,8 @@
bufs.list = NULL;
if (ioctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) return NULL;
- if (bufs.count) {
+ if (!bufs.count) return NULL;
+
if (!(bufs.list = drmMalloc(bufs.count * sizeof(*bufs.list))))
return NULL;
@@ -1074,9 +1075,10 @@
retval->list[i].used = 0;
retval->list[i].address = bufs.list[i].address;
}
+
+ drmFree(bufs.list);
+
return retval;
- }
- return NULL;
}
@@ -1086,7 +1088,8 @@
* \return zero on success, or negative value on failure.
*
* \internal
- * Calls munmap() for every buffer stored in \p bufs.
+ * Calls munmap() for every buffer stored in \p bufs and frees the
+ * memory allocated by drmMapBufs().
*/
int drmUnmapBufs(drmBufMapPtr bufs)
{
@@ -1095,6 +1098,10 @@
for (i = 0; i < bufs->count; i++) {
munmap(bufs->list[i].address, bufs->list[i].total);
}
+
+ drmFree(bufs->list);
+ drmFree(bufs);
+
return 0;
}
------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 -- _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel