Skip to content

Commit

Permalink
surfman/drm: Calloc(3) may fail.
Browse files Browse the repository at this point in the history
ENOMEM is unlikely, but possible. Return NULL instead of crashing...

Signed-off-by: Eric Chanudet <[email protected]>

OXT-1653

(cherry picked from commit 436c87b)
Signed-off-by: Eric Chanudet <[email protected]>
  • Loading branch information
Eric Chanudet committed Jul 25, 2019
1 parent 8f36aa7 commit 1189b08
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/drm/src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ INTERNAL struct drm_plane *drm_device_add_plane(struct drm_device *device, uint3
p = drm_device_find_plane(device, plane);
if (!p) {
p = calloc(1, sizeof (*p));
if (!p)
return NULL;
p->id = plane;
p->device = device;
list_add_tail(&p->l, &device->planes);
Expand Down

0 comments on commit 1189b08

Please sign in to comment.