aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2016-05-12 17:57:07 +0800
committerGerd Hoffmann <kraxel@redhat.com>2016-05-12 16:41:46 +0200
commitf454f49c42d4ec7bdbbb5a7d9c0c8bfb24b28ca4 (patch)
tree735fa69f15943fef44d4e15151880a9d226a5e86 /ui
parent42ddb8aa7c0ad727537db0f1b25c7640b36ef35e (diff)
downloadqemu-f454f49c42d4ec7bdbbb5a7d9c0c8bfb24b28ca4.zip
qemu-f454f49c42d4ec7bdbbb5a7d9c0c8bfb24b28ca4.tar.gz
qemu-f454f49c42d4ec7bdbbb5a7d9c0c8bfb24b28ca4.tar.bz2
egl-helpers: fix possible resource leak
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>
Diffstat (limited to 'ui')
-rw-r--r--ui/egl-helpers.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 558edfd..22835c0 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -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;
}