From a3a26eb6687879e42d061c91021180ad55a68925 Mon Sep 17 00:00:00 2001 From: jbj Date: Fri, 26 Dec 2003 03:36:25 +0000 Subject: [PATCH] fix: double free with sub-pkgs (#112643). CVS patchset: 7007 CVS date: 2003/12/26 03:36:25 --- file/src/apprentice.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/file/src/apprentice.c b/file/src/apprentice.c index 643dfe4..af1b1ef 100644 --- a/file/src/apprentice.c +++ b/file/src/apprentice.c @@ -793,17 +793,13 @@ byteswap(/*@null@*/ struct magic *m, uint32_t nmagic) /* * make a dbname */ +/*@only@*/ static char * mkdbname(const char *fn) /*@*/ { - static const char ext[] = ".mgc"; - /*@only@*/ - static char *buf = NULL; - - buf = xrealloc(buf, strlen(fn) + sizeof(ext) + 1); - (void)strcpy(buf, fn); - (void)strcat(buf, ext); + char * buf = xmalloc(strlen(fn) + sizeof(".mgc")); + (void) stpcpy( stpcpy(buf, fn), ".mgc"); return buf; } -- 2.7.4