svn commit: r327266 - head/usr.bin/rpcgen

Warner Losh imp at FreeBSD.org
Thu Dec 28 05:33:36 UTC 2017


Author: imp
Date: Thu Dec 28 05:33:34 2017
New Revision: 327266
URL: https://svnweb.freebsd.org/changeset/base/327266

Log:
  Free some variables before they go out of scope.
  
  CID: 92074, 270099

Modified:
  head/usr.bin/rpcgen/rpc_main.c

Modified: head/usr.bin/rpcgen/rpc_main.c
==============================================================================
--- head/usr.bin/rpcgen/rpc_main.c	Thu Dec 28 05:33:29 2017	(r327265)
+++ head/usr.bin/rpcgen/rpc_main.c	Thu Dec 28 05:33:34 2017	(r327266)
@@ -484,7 +484,9 @@ generate_guard(const char *pathname)
 			;
 		strcpy(guard, tmp);
 	}
+	tmp = guard;
 	guard = extendfile(guard, "_H_RPCGEN");
+	free(tmp);
 	return (guard);
 }
 
@@ -502,13 +504,14 @@ h_output(const char *infile, const char *define, int e
 	const char *guard;
 	list *l;
 	xdrfunc *xdrfuncp;
+	void *tmp = NULL;
 
 	open_input(infile, define);
 	outfilename =  extend ? extendfile(infile, outfile) : outfile;
 	open_output(infile, outfilename);
 	add_warning();
 	if (outfilename || infile){
-		guard = generate_guard(outfilename ? outfilename: infile);
+		guard = tmp = generate_guard(outfilename ? outfilename: infile);
 	} else
 		guard = "STDIN_";
 
@@ -574,6 +577,7 @@ h_output(const char *infile, const char *define, int e
 	f_print(fout, "#endif\n");
 
 	f_print(fout, "\n#endif /* !_%s */\n", guard);
+	free(tmp);
 }
 
 /*


More information about the svn-src-head mailing list