]> git.proxmox.com Git - mirror_qemu.git/commitdiff
egl-helpers: fix possible resource leak
authorGonglei <arei.gonglei@huawei.com>
Thu, 12 May 2016 09:57:07 +0000 (17:57 +0800)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 12 May 2016 14:41:46 +0000 (16:41 +0200)
CID 1352419, using g_strdup_printf instead of asprintf.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1463047028-123868-2-git-send-email-arei.gonglei@huawei.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/egl-helpers.c

index 558edfdeb75aeecc6c269aff3d9e610ffaef4e20..22835c06262b57f5df441666d1ec8a67dda453c5 100644 (file)
@@ -49,18 +49,15 @@ int qemu_egl_rendernode_open(void)
             continue;
         }
 
-        r = asprintf(&p, "/dev/dri/%s", e->d_name);
-        if (r < 0) {
-            return -1;
-        }
+        p = g_strdup_printf("/dev/dri/%s", e->d_name);
 
         r = open(p, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
         if (r < 0) {
-            free(p);
+            g_free(p);
             continue;
         }
         fd = r;
-        free(p);
+        g_free(p);
         break;
     }