1
0
Fork 0

MLK-16302-1 drm/imx: dpu: plane: Free dpu_plane when bailout from dpu_plane_init

The dpu_plane is allocated with kzalloc() in dpu_plane_init().
In case, dpu_plane_init() fails after that allocation, the bailout path
should free the dpu_plane, otherwise, there will be memory leakage.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 99cb80f855aafbe524519db635c3d03bd4cc8d85)
pull/10/head
Liu Ying 2018-11-28 16:27:39 +08:00
parent a767b27ad8
commit aed3e47d01
1 changed files with 3 additions and 1 deletions

View File

@ -988,8 +988,10 @@ struct dpu_plane *dpu_plane_init(struct drm_device *drm,
ret = -EINVAL;
}
if (ret)
if (ret) {
kfree(dpu_plane);
return ERR_PTR(ret);
}
return dpu_plane;
}