Reduced memory leaks.

I found some more leaks, but are not in inside of iterations.
This commit is contained in:
itohy 1998-11-01 03:07:33 +00:00
parent 841c52934a
commit 6aeb72f23f
5 changed files with 24 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat.c,v 1.24 1998/03/26 19:20:36 christos Exp $ */ /* $NetBSD: compat.c,v 1.25 1998/11/01 03:07:33 itohy Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -39,14 +39,14 @@
*/ */
#ifdef MAKE_BOOTSTRAP #ifdef MAKE_BOOTSTRAP
static char rcsid[] = "$NetBSD: compat.c,v 1.24 1998/03/26 19:20:36 christos Exp $"; static char rcsid[] = "$NetBSD: compat.c,v 1.25 1998/11/01 03:07:33 itohy Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: compat.c,v 1.24 1998/03/26 19:20:36 christos Exp $"); __RCSID("$NetBSD: compat.c,v 1.25 1998/11/01 03:07:33 itohy Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -291,8 +291,10 @@ CompatRunCommand (cmdp, gnp)
} }
_exit(1); _exit(1);
} }
if (bp) if (bp) {
free(av);
free(bp); free(bp);
}
free(cmdStart); free(cmdStart);
Lst_Replace (cmdNode, (ClientData) NULL); Lst_Replace (cmdNode, (ClientData) NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.22 1998/03/26 19:20:36 christos Exp $ */ /* $NetBSD: job.c,v 1.23 1998/11/01 03:07:34 itohy Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -39,14 +39,14 @@
*/ */
#ifdef MAKE_BOOTSTRAP #ifdef MAKE_BOOTSTRAP
static char rcsid[] = "$NetBSD: job.c,v 1.22 1998/03/26 19:20:36 christos Exp $"; static char rcsid[] = "$NetBSD: job.c,v 1.23 1998/11/01 03:07:34 itohy Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: job.c,v 1.22 1998/03/26 19:20:36 christos Exp $"); __RCSID("$NetBSD: job.c,v 1.23 1998/11/01 03:07:34 itohy Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -643,6 +643,7 @@ JobPrintCommand(cmdp, jobp)
} }
DBPRINTF(cmdTemplate, cmd); DBPRINTF(cmdTemplate, cmd);
free(cmdStart);
if (errOff) { if (errOff) {
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.44 1998/11/01 03:01:53 itohy Exp $ */ /* $NetBSD: main.c,v 1.45 1998/11/01 03:07:34 itohy Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -39,7 +39,7 @@
*/ */
#ifdef MAKE_BOOTSTRAP #ifdef MAKE_BOOTSTRAP
static char rcsid[] = "$NetBSD: main.c,v 1.44 1998/11/01 03:01:53 itohy Exp $"; static char rcsid[] = "$NetBSD: main.c,v 1.45 1998/11/01 03:07:34 itohy Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: main.c,v 1.44 1998/11/01 03:01:53 itohy Exp $"); __RCSID("$NetBSD: main.c,v 1.45 1998/11/01 03:07:34 itohy Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -395,6 +395,7 @@ Main_ParseArgLine(line)
free(p1); free(p1);
argv = brk_string(buf, &argc, TRUE, &args); argv = brk_string(buf, &argc, TRUE, &args);
free(buf);
MainParseArgs(argc, argv); MainParseArgs(argc, argv);
free(args); free(args);

View File

@ -1,4 +1,4 @@
/* $NetBSD: suff.c,v 1.22 1998/11/01 03:05:03 itohy Exp $ */ /* $NetBSD: suff.c,v 1.23 1998/11/01 03:07:34 itohy Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -39,14 +39,14 @@
*/ */
#ifdef MAKE_BOOTSTRAP #ifdef MAKE_BOOTSTRAP
static char rcsid[] = "$NetBSD: suff.c,v 1.22 1998/11/01 03:05:03 itohy Exp $"; static char rcsid[] = "$NetBSD: suff.c,v 1.23 1998/11/01 03:07:34 itohy Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
#else #else
__RCSID("$NetBSD: suff.c,v 1.22 1998/11/01 03:05:03 itohy Exp $"); __RCSID("$NetBSD: suff.c,v 1.23 1998/11/01 03:07:34 itohy Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -2110,6 +2110,7 @@ sfnd_abort:
* children or commands) as the old pmake did. * children or commands) as the old pmake did.
*/ */
if ((gn->type & (OP_PHONY|OP_NOPATH)) == 0) { if ((gn->type & (OP_PHONY|OP_NOPATH)) == 0) {
free(gn->path);
gn->path = Dir_FindFile(gn->name, gn->path = Dir_FindFile(gn->name,
(targ == NULL ? dirSearchPath : (targ == NULL ? dirSearchPath :
targ->suff->searchPath)); targ->suff->searchPath));

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.28 1998/10/13 17:09:16 wsanchez Exp $ */ /* $NetBSD: var.c,v 1.29 1998/11/01 03:07:34 itohy Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -39,14 +39,14 @@
*/ */
#ifdef MAKE_BOOTSTRAP #ifdef MAKE_BOOTSTRAP
static char rcsid[] = "$NetBSD: var.c,v 1.28 1998/10/13 17:09:16 wsanchez Exp $"; static char rcsid[] = "$NetBSD: var.c,v 1.29 1998/11/01 03:07:34 itohy Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: var.c,v 1.28 1998/10/13 17:09:16 wsanchez Exp $"); __RCSID("$NetBSD: var.c,v 1.29 1998/11/01 03:07:34 itohy Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -607,6 +607,7 @@ Var_Value (name, ctxt, frp)
if (v != (Var *) NIL) { if (v != (Var *) NIL) {
char *p = ((char *)Buf_GetAll(v->val, (int *)NULL)); char *p = ((char *)Buf_GetAll(v->val, (int *)NULL));
if (v->flags & VAR_FROM_ENV) { if (v->flags & VAR_FROM_ENV) {
free(v->name);
Buf_Destroy(v->val, FALSE); Buf_Destroy(v->val, FALSE);
free((Address) v); free((Address) v);
*frp = p; *frp = p;
@ -2121,6 +2122,7 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
*/ */
*freePtr = TRUE; *freePtr = TRUE;
} }
free(v->name);
Buf_Destroy(v->val, destroy); Buf_Destroy(v->val, destroy);
free((Address)v); free((Address)v);
} else if (v->flags & VAR_JUNK) { } else if (v->flags & VAR_JUNK) {