diff mbox series

[libdrm] xf86drm: Fix possible memory leak with drmModeGetPropertyPtr()

Message ID 1556529052-6413-1-git-send-email-sw0312.kim@samsung.com (mailing list archive)
State New, archived
Headers show
Series [libdrm] xf86drm: Fix possible memory leak with drmModeGetPropertyPtr() | expand

Commit Message

Seung-Woo Kim April 29, 2019, 9:10 a.m. UTC
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>
---
 xf86drmMode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Eric Engestrom May 3, 2019, 11:49 a.m. UTC | #1
On Monday, 2019-04-29 18:10:52 +0900, Seung-Woo Kim wrote:
> 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>
and pushed, thanks!

> ---
>  xf86drmMode.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/xf86drmMode.c b/xf86drmMode.c
> index c878d9e..207d7be 100644
> --- a/xf86drmMode.c
> +++ b/xf86drmMode.c
> @@ -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;
> -- 
> 1.7.4.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/xf86drmMode.c b/xf86drmMode.c
index c878d9e..207d7be 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -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;