From 524f48c4f7c89564d9d041cf49cafcd07b657868 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 31 Aug 2025 14:06:59 -0700 Subject: [PATCH] R128SetupConnectors: avoid memory leak in error path 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 Part-of: --- src/r128_output.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;