mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-06-07 02:58:22 +02:00
xkb: plug memory leaks in InitKeyboardDeviceStructInternal() error paths
Reported in #1817: xwayland-24.1.6/redhat-linux-build/../xkb/xkbInit.c:527:5: warning[-Wanalyzer-malloc-leak]: leak of ‘rmlvo_dflts.layout’ xwayland-24.1.6/redhat-linux-build/../xkb/xkbInit.c:527:5: warning[-Wanalyzer-malloc-leak]: leak of ‘rmlvo_dflts.model’ xwayland-24.1.6/redhat-linux-build/../xkb/xkbInit.c:527:5: warning[-Wanalyzer-malloc-leak]: leak of ‘rmlvo_dflts.options’ xwayland-24.1.6/redhat-linux-build/../xkb/xkbInit.c:527:5: warning[-Wanalyzer-malloc-leak]: leak of ‘rmlvo_dflts.rules’ xwayland-24.1.6/redhat-linux-build/../xkb/xkbInit.c:527:5: warning[-Wanalyzer-malloc-leak]: leak of ‘rmlvo_dflts.variant’ Fixes:56a5955c8("xkb: strdup the values returned by XkbGetRulesDflts") Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2169> (cherry picked from commit97cf051dfc)
This commit is contained in:
parent
ed4a6bdff6
commit
b72a2f0e8a
1 changed files with 3 additions and 1 deletions
|
|
@ -542,7 +542,7 @@ InitKeyboardDeviceStructInternal(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
|
|||
dev->key = calloc(1, sizeof(*dev->key));
|
||||
if (!dev->key) {
|
||||
ErrorF("XKB: Failed to allocate key class\n");
|
||||
return FALSE;
|
||||
goto unwind_rmlvo;
|
||||
}
|
||||
dev->key->sourceid = dev->id;
|
||||
|
||||
|
|
@ -661,6 +661,8 @@ InitKeyboardDeviceStructInternal(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
|
|||
unwind_key:
|
||||
free(dev->key);
|
||||
dev->key = NULL;
|
||||
unwind_rmlvo:
|
||||
XkbFreeRMLVOSet(&rmlvo_dflts, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue