summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2001-05-14 12:55:49 +0000
committerMarc Espie <espie@cvs.openbsd.org>2001-05-14 12:55:49 +0000
commite16d2ab2222a1759010c7f0da9b4ccd367827a36 (patch)
treeab23e40fdb574a9fb7faf11799d25d2f8f150e1a
parent87302a0a3d2b0cb6b4a107263f308e43460c1152 (diff)
Ensure IFile str is always intialized, so that we can free it without
problems. Bug found by wilfried@.
-rw-r--r--usr.bin/make/lowparse.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/make/lowparse.c b/usr.bin/make/lowparse.c
index 19f527cc656..40df479384a 100644
--- a/usr.bin/make/lowparse.c
+++ b/usr.bin/make/lowparse.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: lowparse.c,v 1.7 2001/05/07 22:57:19 espie Exp $ */
+/* $OpenBSD: lowparse.c,v 1.8 2001/05/14 12:55:48 espie Exp $ */
/* low-level parsing functions. */
@@ -136,6 +136,7 @@ new_ifile(name, stream)
ifile = emalloc(sizeof(*ifile));
ifile->fname = name;
+ ifile->str = NULL;
/* Naturally enough, we start reading at line 0 */
ifile->lineno = 0;
ifile->F = stream;
@@ -149,8 +150,7 @@ free_ifile(ifile)
{
if (ifile->F && fileno(ifile->F) != STDIN_FILENO)
(void)fclose(ifile->F);
- else
- free(ifile->str);
+ free(ifile->str);
/* Note we can't free the file names yet, as they are embedded in GN for
* error reports. */
free(ifile);