summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorRami Ylimäki <rami.ylimaki@vincit.fi>2011-03-30 16:47:31 +0300
committerPeter Hutterer <peter.hutterer@who-t.net>2011-04-04 09:55:05 +1000
commit9c4aae2141161e4bf69313a771db91c0acc4cc83 (patch)
tree71d34215c1b2e90866005ec0df38f77abfea833e /xkb
parent29d63ba175ff1ef1587c390b18ce61c8f1c150f3 (diff)
xkb: Prevent leaking of XKB geometry information on copy.
Currently shapes, sections and doodads may leak on copy. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi> Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'xkb')
-rw-r--r--xkb/xkbUtils.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index a80a8d8fd..cc9aaa75a 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1541,10 +1541,10 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
}
if (src->geom->num_shapes) {
- tmp = calloc(src->geom->num_shapes, sizeof(XkbShapeRec));
- if (!tmp)
+ /* Reallocate and clear all items. */
+ if (!XkbGeomRealloc((void **)&dst->geom->shapes, dst->geom->sz_shapes, src->geom->num_shapes,
+ sizeof(XkbShapeRec), XKB_GEOM_CLEAR_ALL))
return FALSE;
- dst->geom->shapes = tmp;
for (i = 0, sshape = src->geom->shapes, dshape = dst->geom->shapes;
i < src->geom->num_shapes;
@@ -1661,7 +1661,6 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
}
dst->geom->num_sections = 0;
- dst->geom->sections = NULL;
}
if (src->geom->num_sections) {
@@ -1771,7 +1770,6 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
}
}
dst->geom->num_doodads = 0;
- dst->geom->doodads = NULL;
}
if (src->geom->num_doodads) {