diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index 78bc610ae8e..34755349d21 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -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 extend, const char *outfile 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 extend, const char *outfile f_print(fout, "#endif\n"); f_print(fout, "\n#endif /* !_%s */\n", guard); + free(tmp); } /*