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.
@ -39,14 +39,14 @@
*/
#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
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#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 /* not lint */
#endif
@ -291,8 +291,10 @@ CompatRunCommand (cmdp, gnp)
}
_exit(1);
}
if (bp)
free(bp);
if (bp) {
free(av);
free(bp);
}
free(cmdStart);
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.
@ -39,14 +39,14 @@
*/
#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
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#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 /* not lint */
#endif
@ -643,6 +643,7 @@ JobPrintCommand(cmdp, jobp)
}
DBPRINTF(cmdTemplate, cmd);
free(cmdStart);
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
@ -39,7 +39,7 @@
*/
#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
#include <sys/cdefs.h>
#ifndef lint
@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#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 /* not lint */
#endif
@ -395,6 +395,7 @@ Main_ParseArgLine(line)
free(p1);
argv = brk_string(buf, &argc, TRUE, &args);
free(buf);
MainParseArgs(argc, argv);
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
@ -39,14 +39,14 @@
*/
#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
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
#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 /* not lint */
#endif
@ -2110,6 +2110,7 @@ sfnd_abort:
* children or commands) as the old pmake did.
*/
if ((gn->type & (OP_PHONY|OP_NOPATH)) == 0) {
free(gn->path);
gn->path = Dir_FindFile(gn->name,
(targ == NULL ? dirSearchPath :
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
@ -39,14 +39,14 @@
*/
#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
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#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 /* not lint */
#endif
@ -607,6 +607,7 @@ Var_Value (name, ctxt, frp)
if (v != (Var *) NIL) {
char *p = ((char *)Buf_GetAll(v->val, (int *)NULL));
if (v->flags & VAR_FROM_ENV) {
free(v->name);
Buf_Destroy(v->val, FALSE);
free((Address) v);
*frp = p;
@ -2121,6 +2122,7 @@ Var_Parse (str, ctxt, err, lengthPtr, freePtr)
*/
*freePtr = TRUE;
}
free(v->name);
Buf_Destroy(v->val, destroy);
free((Address)v);
} else if (v->flags & VAR_JUNK) {