OSDN Git Service

xf86drm: Fix possible memory leak with drmModeGetPropertyPtr()
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 29 Apr 2019 09:10:52 +0000 (18:10 +0900)
committerEric Engestrom <eric.engestrom@intel.com>
Fri, 3 May 2019 11:47:42 +0000 (12:47 +0100)
In drmModeGetPropertyPtr(), from upper error path, it calls free
but with just next error path, it does not call. Fix the possible
memory leak.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
xf86drmMode.c

index c878d9e..207d7be 100644 (file)
@@ -650,7 +650,7 @@ drm_public drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
        }
 
        if (!(r = drmMalloc(sizeof(*r))))
-               return NULL;
+               goto err_allocs;
 
        r->prop_id = prop.prop_id;
        r->count_values = prop.count_values;