From d040bda3cfeac552751e8e0e020ddac8c6b2a962 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Mon, 7 Jan 2013 18:15:15 +0000 Subject: [PATCH] - always initialize ml->map - free map --- src/apprentice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apprentice.c b/src/apprentice.c index ddda783d..d45814bc 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: apprentice.c,v 1.183 2013/01/07 02:11:22 christos Exp $") +FILE_RCSID("@(#)$File: apprentice.c,v 1.184 2013/01/07 18:06:40 christos Exp $") #endif /* lint */ #include "magic.h" @@ -275,8 +275,7 @@ add_mlist(struct mlist *mlp, struct magic_map *map, size_t idx) if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL) return -1; - if (idx == 0) - ml->map = map; + ml->map = idx == 0 ? map : NULL; ml->magic = map->magic[idx]; ml->nmagic = map->nmagic[idx]; @@ -402,6 +401,7 @@ apprentice_unmap(struct magic_map *map) else #endif free(map->p); + free(map); } private struct mlist * -- 2.40.0