mirror of
https://github.com/X11Libre/xf86-video-r128.git
synced 2026-03-24 01:24:26 +00:00
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 <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-r128/-/merge_requests/20>
This commit is contained in:
committed by
Enrico Weigelt, metux IT consult
parent
b7f5ef0c68
commit
a0db273639
@@ -556,7 +556,10 @@ Bool R128SetupConnectors(ScrnInfoPtr pScrn)
|
|||||||
output = R128OutputCreate(pScrn, "DVI-%d", --num_dvi);
|
output = R128OutputCreate(pScrn, "DVI-%d", --num_dvi);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!output) return FALSE;
|
if (!output) {
|
||||||
|
free(r128_output);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
output->interlaceAllowed = TRUE;
|
output->interlaceAllowed = TRUE;
|
||||||
output->doubleScanAllowed = TRUE;
|
output->doubleScanAllowed = TRUE;
|
||||||
output->driver_private = r128_output;
|
output->driver_private = r128_output;
|
||||||
|
|||||||
Reference in New Issue
Block a user