Skip to content
Snippets Groups Projects
Commit f454f49c authored by Gonglei (Arei)'s avatar Gonglei (Arei) Committed by Gerd Hoffmann
Browse files

egl-helpers: fix possible resource leak


CID 1352419, using g_strdup_printf instead of asprintf.

Signed-off-by: default avatarGonglei <arei.gonglei@huawei.com>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Message-id: 1463047028-123868-2-git-send-email-arei.gonglei@huawei.com
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 42ddb8aa
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment