#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.201 2014/03/14 17:38:33 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.202 2014/03/14 18:48:11 christos Exp $")
#endif /* lint */
#include "magic.h"
{
if (map == NULL)
return;
- if (map->p == NULL)
- return;
+ if (map->p != NULL) {
#ifdef QUICK
- if (map->len)
- (void)munmap(map->p, map->len);
- else
+ if (map->len)
+ (void)munmap(map->p, map->len);
+ else
#endif
free(map->p);
+ } else {
+ uint32_t j;
+ for (j = 0; j < MAGIC_SETS; j++)
+ free(map->magic[j]);
+ }
free(map);
}
magic_entry_free(mset[j].me, mset[j].count);
if (errs) {
- for (j = 0; j < MAGIC_SETS; j++) {
- if (map->magic[j])
- free(map->magic[j]);
- }
- free(map);
+ apprentice_unmap(map);
return NULL;
}
return map;