diff options
| author | christos <christos@NetBSD.org> | 2006-04-09 19:21:26 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2006-04-09 19:21:26 +0000 |
| commit | 5d96bf2cf0c00a9864ebab28d7c4f6fcdbc21812 (patch) | |
| tree | 73f64493cc2e82b8f2261e615a2d3f39d6d3dce6 /usr.bin | |
| parent | bd21f84917fa454d1060c8d2f7b29dfc03d49826 (diff) | |
Coverity CID 2333: Fix memory leak.
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/error/pi.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/error/pi.c b/usr.bin/error/pi.c index 2107907e55e..94efd954257 100644 --- a/usr.bin/error/pi.c +++ b/usr.bin/error/pi.c @@ -1,4 +1,4 @@ -/* $NetBSD: pi.c,v 1.11 2003/08/07 11:13:38 agc Exp $ */ +/* $NetBSD: pi.c,v 1.12 2006/04/09 19:21:26 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,12 +34,13 @@ #if 0 static char sccsid[] = "@(#)pi.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: pi.c,v 1.11 2003/08/07 11:13:38 agc Exp $"); +__RCSID("$NetBSD: pi.c,v 1.12 2006/04/09 19:21:26 christos Exp $"); #endif /* not lint */ #include <stdio.h> #include <ctype.h> #include <string.h> +#include <stdlib.h> #include "error.h" static char *c_linenumber; @@ -317,6 +318,10 @@ pi(void) ){ for (wordindex = undefined ? 5 : 6; wordindex <= wordc; wordindex++){ + if (nwordv) { + free(nwordv[0]); + free(nwordv); + } nwordv = wordvsplice(2, undefined ? 2 : 3, wordv+1); nwordv[0] = strdup(currentfilename); nwordv[1] = wordv[wordindex]; |
