glamor: handle allocation failure in glamor_create_pixmap()

Reported by gcc 15.1:

../glamor/glamor.c: In function ‘glamor_create_pixmap’:
../glamor/glamor.c:233:23: warning: potential null pointer dereference
 [-Wnull-dereference]
  233 |     pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
      |     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
../glamor/glamor.c:228:26: warning: potential null pointer dereference
 [-Wnull-dereference]
  228 |     pixmap_priv->is_cbcr = (GLAMOR_CREATE_FORMAT_CBCR & usage) == GLAMOR_CREATE_FORMAT_CBCR;

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
This commit is contained in:
Alan Coopersmith
2025-11-25 00:40:39 +02:00
committed by Enrico Weigelt
parent 794c8e04a1
commit d228cfd194

View File

@@ -232,6 +232,9 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
else
pixmap = fbCreatePixmap(screen, 0, 0, depth, usage);
if (!pixmap)
return NullPixmap;
pixmap_priv = glamor_get_pixmap_private(pixmap);
BUG_RETURN_VAL(!pixmap_priv, NULL);