[PATCH xserver 2/2] xkb: Prevent leaking of XKB geometry information on copy.

Peter Hutterer peter.hutterer at who-t.net
Thu Mar 17 18:29:11 PDT 2011


On Thu, Mar 17, 2011 at 10:40:01AM +0200, Rami Ylimäki wrote:
> Currently shapes, sections and doodads may leak on copy.
> 
> Reviewed-by: Erkki Seppälä <erkki.seppala at vincit.fi>
> Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>


> ---
>  xkb/xkbUtils.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
> index f4c8a6e..e7681de 100644
> --- a/xkb/xkbUtils.c
> +++ b/xkb/xkbUtils.c
> @@ -1577,7 +1577,9 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
>          }
>  
>          if (src->geom->num_shapes) {
> -            tmp = calloc(src->geom->num_shapes, sizeof(XkbShapeRec));
> +            /* Reallocate and clear all items. */
> +            tmp = _XkbGeomRealloc(dst->geom->shapes, dst->geom->sz_shapes, src->geom->num_shapes,
> +                                  0, src->geom->num_shapes, sizeof(XkbShapeRec));
>              if (!tmp)
>                  return FALSE;
>              dst->geom->shapes = tmp;
> @@ -1697,7 +1699,6 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
>              }
>  
>              dst->geom->num_sections = 0;
> -            dst->geom->sections = NULL;
>          }
>  
>          if (src->geom->num_sections) {
> @@ -1809,7 +1810,6 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
>                  }
>              }
>              dst->geom->num_doodads = 0;
> -            dst->geom->doodads = NULL;
>          }
>  
>          if (src->geom->num_doodads) {
> -- 
> 1.6.3.3
> 


More information about the xorg-devel mailing list