mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-20 05:50:12 +01:00
modes: Fix previous commit for potential legal NULLs
If the count is 0, then the malloc is permitted to return NULL, so don't throw an error in that case. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
85fb3e55fd
commit
e6c136ca7a
1 changed files with 5 additions and 1 deletions
|
|
@ -206,7 +206,11 @@ retry:
|
||||||
r->crtcs = drmAllocCpy(U642VOID(res.crtc_id_ptr), res.count_crtcs, sizeof(uint32_t));
|
r->crtcs = drmAllocCpy(U642VOID(res.crtc_id_ptr), res.count_crtcs, sizeof(uint32_t));
|
||||||
r->connectors = drmAllocCpy(U642VOID(res.connector_id_ptr), res.count_connectors, sizeof(uint32_t));
|
r->connectors = drmAllocCpy(U642VOID(res.connector_id_ptr), res.count_connectors, sizeof(uint32_t));
|
||||||
r->encoders = drmAllocCpy(U642VOID(res.encoder_id_ptr), res.count_encoders, sizeof(uint32_t));
|
r->encoders = drmAllocCpy(U642VOID(res.encoder_id_ptr), res.count_encoders, sizeof(uint32_t));
|
||||||
if (!r->fbs || !r->crtcs || !r->connectors || !r->encoders) {
|
if ((res.count_fbs && !r->fbs) ||
|
||||||
|
(res.count_crtcs && !r->crtcs) ||
|
||||||
|
(res.count_connectors && !r->connectors) ||
|
||||||
|
(res.count_encoders && !r->encoders))
|
||||||
|
{
|
||||||
drmFree(r->fbs);
|
drmFree(r->fbs);
|
||||||
drmFree(r->crtcs);
|
drmFree(r->crtcs);
|
||||||
drmFree(r->connectors);
|
drmFree(r->connectors);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue