Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/xf86-video-ati-kms/dist/src fix a couple of i...



details:   https://anonhg.NetBSD.org/xsrc/rev/05046bba5dc6
branches:  trunk
changeset: 10764:05046bba5dc6
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Jul 11 21:24:14 2021 +0000

description:
fix a couple of issues found while testing new drm.

- actually check the return value of radeon_bo_open() in a three places
- for create_pixmap_for_fbcon(), release the bo when jumping to
  'out_free_fb'.  fixes memory leak.

diffstat:

 external/mit/xf86-video-ati-kms/dist/src/drmmode_display.c  |  6 +++---
 external/mit/xf86-video-ati-kms/dist/src/radeon_bo_helper.c |  4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diffs (52 lines):

diff -r 2cdd22de32db -r 05046bba5dc6 external/mit/xf86-video-ati-kms/dist/src/drmmode_display.c
--- a/external/mit/xf86-video-ati-kms/dist/src/drmmode_display.c        Sun Jul 11 20:40:33 2021 +0000
+++ b/external/mit/xf86-video-ati-kms/dist/src/drmmode_display.c        Sun Jul 11 21:24:14 2021 +0000
@@ -373,7 +373,7 @@
        RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
        RADEONInfoPtr info = RADEONPTR(pScrn);
        PixmapPtr pixmap = info->fbcon_pixmap;
-       struct radeon_buffer *bo;
+       struct radeon_buffer *bo = NULL;
        drmModeFBPtr fbcon;
        struct drm_gem_flink flink;
 
@@ -405,7 +405,7 @@
        bo->ref_count = 1;
 
        bo->bo.radeon = radeon_bo_open(drmmode->bufmgr, flink.name, 0, 0, 0, 0);
-       if (!bo) {
+       if (!bo->bo.radeon) {
                xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                           "Couldn't open BO for fbcon handle\n");
                goto out_free_fb;
@@ -415,8 +415,8 @@
                                          fbcon->depth, fbcon->bpp, fbcon->pitch,
                                          bo);
        info->fbcon_pixmap = pixmap;
+out_free_fb:
        radeon_buffer_unref(&bo);
-out_free_fb:
        drmModeFreeFB(fbcon);
        return pixmap;
 }
diff -r 2cdd22de32db -r 05046bba5dc6 external/mit/xf86-video-ati-kms/dist/src/radeon_bo_helper.c
--- a/external/mit/xf86-video-ati-kms/dist/src/radeon_bo_helper.c       Sun Jul 11 20:40:33 2021 +0000
+++ b/external/mit/xf86-video-ati-kms/dist/src/radeon_bo_helper.c       Sun Jul 11 21:24:14 2021 +0000
@@ -308,7 +308,7 @@
     bo->bo.radeon = radeon_bo_open(info->bufmgr, 0, size, base_align,
                                   domain, flags);
 
-    if (bo && tiling && radeon_bo_set_tiling(bo->bo.radeon, tiling, pitch) == 0)
+    if (bo->bo.radeon && tiling && radeon_bo_set_tiling(bo->bo.radeon, tiling, pitch) == 0)
        *new_tiling = tiling;
 
     *new_pitch = pitch;
@@ -504,7 +504,7 @@
 #endif
 
     bo->bo.radeon = radeon_gem_bo_open_prime(info->bufmgr, ihandle, size);
-    if (!bo)
+    if (!bo->bo.radeon)
         goto error;
 
     bo->ref_count = 1;



Home | Main Index | Thread Index | Old Index