Free some variables before they go out of scope.

CID: 92074, 270099
This commit is contained in:
Warner Losh 2017-12-28 05:33:34 +00:00
parent e893031d91
commit 074170fb81

View File

@ -484,7 +484,9 @@ generate_guard(const char *pathname)
; ;
strcpy(guard, tmp); strcpy(guard, tmp);
} }
tmp = guard;
guard = extendfile(guard, "_H_RPCGEN"); guard = extendfile(guard, "_H_RPCGEN");
free(tmp);
return (guard); return (guard);
} }
@ -502,13 +504,14 @@ h_output(const char *infile, const char *define, int extend, const char *outfile
const char *guard; const char *guard;
list *l; list *l;
xdrfunc *xdrfuncp; xdrfunc *xdrfuncp;
void *tmp = NULL;
open_input(infile, define); open_input(infile, define);
outfilename = extend ? extendfile(infile, outfile) : outfile; outfilename = extend ? extendfile(infile, outfile) : outfile;
open_output(infile, outfilename); open_output(infile, outfilename);
add_warning(); add_warning();
if (outfilename || infile){ if (outfilename || infile){
guard = generate_guard(outfilename ? outfilename: infile); guard = tmp = generate_guard(outfilename ? outfilename: infile);
} else } else
guard = "STDIN_"; 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, "#endif\n");
f_print(fout, "\n#endif /* !_%s */\n", guard); f_print(fout, "\n#endif /* !_%s */\n", guard);
free(tmp);
} }
/* /*