diff options
author | David Hill <dhill@cvs.openbsd.org> | 2006-03-22 18:20:32 +0000 |
---|---|---|
committer | David Hill <dhill@cvs.openbsd.org> | 2006-03-22 18:20:32 +0000 |
commit | 725cd45607e654de459898ed4b7e2fd7827d6120 (patch) | |
tree | 7ff1823a0507e963e55c1d4dd62d6c44db57f39f | |
parent | afb79f93e400b36d35786c8fb51ca0da349a9ee8 (diff) |
NetBSD - plug leak in generate_guard()
- plug leak in h_output(), coverity cid 100
NetBSD plug leak, coverity cid 98.
NetBSD plug leak, coverity cid 94.
ok ray@ jaredy@ moritz@
-rw-r--r-- | usr.bin/rpcgen/rpc_main.c | 13 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_parse.c | 3 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_scan.c | 3 |
3 files changed, 13 insertions, 6 deletions
diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index fda0bddff3c..08235afe1e5 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_main.c,v 1.20 2004/05/09 22:22:45 deraadt Exp $ */ +/* $OpenBSD: rpc_main.c,v 1.21 2006/03/22 18:20:31 dhill Exp $ */ /* $NetBSD: rpc_main.c,v 1.9 1996/02/19 11:12:43 pk Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -32,7 +32,7 @@ #ifndef lint static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; -static char cvsid[] = "$OpenBSD: rpc_main.c,v 1.20 2004/05/09 22:22:45 deraadt Exp $"; +static char cvsid[] = "$OpenBSD: rpc_main.c,v 1.21 2006/03/22 18:20:31 dhill Exp $"; #endif /* @@ -487,7 +487,7 @@ char rpcgen_table_dcl[] = "struct rpcgen_table {\n\ static char * generate_guard(char *pathname) { - char *filename, *guard, *tmp; + char *filename, *guard, *tmp, *tmp2; filename = strrchr(pathname, '/'); /* find last component */ filename = ((filename == 0) ? pathname : filename + 1); @@ -505,7 +505,10 @@ generate_guard(char *pathname) tmp++; } - guard = extendfile(guard, "_H_RPCGEN"); + tmp2 = extendfile(guard, "_H_RPCGEN"); + free(guard); + guard = tmp2; + return (guard); } @@ -557,6 +560,8 @@ h_output(infile, define, extend, outfile) fprintf(fout, rpcgen_table_dcl); } fprintf(fout, "\n#endif /* !_%s */\n", guard); + + free(guard); } /* diff --git a/usr.bin/rpcgen/rpc_parse.c b/usr.bin/rpcgen/rpc_parse.c index 60895c4bff0..a84e760bcfb 100644 --- a/usr.bin/rpcgen/rpc_parse.c +++ b/usr.bin/rpcgen/rpc_parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_parse.c,v 1.14 2003/07/09 03:35:21 deraadt Exp $ */ +/* $OpenBSD: rpc_parse.c,v 1.15 2006/03/22 18:20:31 dhill Exp $ */ /* $NetBSD: rpc_parse.c,v 1.5 1995/08/29 23:05:55 cgd Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -91,6 +91,7 @@ get_definition(void) def_const(defp); break; case TOK_EOF: + free(defp); return (NULL); default: error("definition keyword expected"); diff --git a/usr.bin/rpcgen/rpc_scan.c b/usr.bin/rpcgen/rpc_scan.c index 5fa50842af1..4181ef4c96e 100644 --- a/usr.bin/rpcgen/rpc_scan.c +++ b/usr.bin/rpcgen/rpc_scan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_scan.c,v 1.11 2003/03/30 20:57:27 deraadt Exp $ */ +/* $OpenBSD: rpc_scan.c,v 1.12 2006/03/22 18:20:31 dhill Exp $ */ /* $NetBSD: rpc_scan.c,v 1.4 1995/06/11 21:50:02 pk Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -508,6 +508,7 @@ docppline(line, lineno, fname) *p = 0; if (*file == 0) { *fname = NULL; + free(file); } else { *fname = file; } |