Fixed potential memory leaks in simple-dmabuf-drm.c found by Cppcheck.

This commit is contained in:
orbitcowboy 2018-10-05 16:02:10 +00:00 committed by Daniel Stone
parent a864f58f44
commit 1f3fae2f1a
1 changed files with 5 additions and 1 deletions

View File

@ -392,8 +392,11 @@ drm_device_init(struct buffer *buf)
#ifdef HAVE_LIBDRM_INTEL
else if (!strcmp(dev->name, "i915")) {
buf->bufmgr = drm_intel_bufmgr_gem_init(buf->drm_fd, 32);
if (!buf->bufmgr)
if (!buf->bufmgr) {
free(dev->name);
free(dev);
return 0;
}
dev->alloc_bo = intel_alloc_bo;
dev->free_bo = intel_free_bo;
dev->export_bo_to_prime = intel_bo_export_to_prime;
@ -425,6 +428,7 @@ drm_device_init(struct buffer *buf)
else {
fprintf(stderr, "Error: drm device %s unsupported.\n",
dev->name);
free(dev->name);
free(dev);
return 0;
}