summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2025-08-31 14:06:59 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2025-08-31 14:06:59 -0700
commit524f48c4f7c89564d9d041cf49cafcd07b657868 (patch)
tree8626c5c01b3a20f8d4fd57b6642cc318601c306d
parent7d1c885bef4df822bc00623ae54baf4be4be2f0a (diff)
R128SetupConnectors: avoid memory leak in error pathHEADmaster
Reported by Oracle Parfait 16.2 static analyzer: Error: Memory leak Memory leak [memory-leak]: Memory leak of pointer r128_output allocated with XNFcallocarray(1, 56) at line 558 of driver/xf86-video-r128/src/r128_output.c in function 'R128SetupConnectors'. calloc called at line 35 of xserver/os/alloc.c in function 'XNFcallocarray' Allocated value returned to caller at line 39 r128_output allocated at line 543 of driver/xf86-video-r128/src/r128_output.c in function 'R128SetupConnectors' with XNFcallocarray(1, 56) r128_output leaks when output == NULL at line 558 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-r128/-/merge_requests/20>
-rw-r--r--src/r128_output.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/r128_output.c b/src/r128_output.c
index 6543971..27b3fbd 100644
--- a/src/r128_output.c
+++ b/src/r128_output.c
@@ -555,7 +555,10 @@ Bool R128SetupConnectors(ScrnInfoPtr pScrn)
output = R128OutputCreate(pScrn, "DVI-%d", --num_dvi);
}
- if (!output) return FALSE;
+ if (!output) {
+ free(r128_output);
+ return FALSE;
+ }
output->interlaceAllowed = TRUE;
output->doubleScanAllowed = TRUE;
output->driver_private = r128_output;