xkb: ensure XkbAllocNames sets num_rg to 0 on allocation failure
If there was a previous radio_groups array which we failed to realloc and freed instead, clear the array size in the XkbNamesRec. Taken from xorg/lib/libx11@258a8ced681dc1bc50396be7439fce23f9807e2a Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1821>
This commit is contained in:
parent
f73f8ccb60
commit
09c6f09eb7
|
@ -192,8 +192,10 @@ XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases)
|
||||||
free(prev_radio_groups);
|
free(prev_radio_groups);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (names->radio_groups == NULL)
|
if (names->radio_groups == NULL) {
|
||||||
|
names->num_rg = 0;
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
}
|
||||||
names->num_rg = nTotalRG;
|
names->num_rg = nTotalRG;
|
||||||
}
|
}
|
||||||
return Success;
|
return Success;
|
||||||
|
|
Loading…
Reference in New Issue