mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-27 03:45:34 +00:00
glx: protect createModeFromConfig() from allocation failure
| ../glx/glxdricommon.c: In function ‘createModeFromConfig’: | ../glx/glxdricommon.c:142:23: warning: dereference of possibly-NULL ‘config’ [CWE-690] [-Wanalyzer-possible-null-dereference] | 142 | config->driConfig = driConfig; Consumers can already handle returning NULL, so this seems the best compromise. It will look like we don't have any modes at all. Certainly not nice, but at least better than completely crashing the Xserver. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
@@ -136,6 +136,8 @@ createModeFromConfig(const __DRIcoreExtension * core,
|
||||
|
||||
|
||||
config = calloc(1, sizeof *config);
|
||||
if (!config)
|
||||
return NULL;
|
||||
|
||||
config->driConfig = driConfig;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user