CodeQL MemoryMayNotBeFreed.ql ResRex.c ResCheckSimNodes()
created use of 'alloc' local variable to track when an allocation occurred so exit path logic is more straight forward for compiler/analyser to see potential optimisations.
This commit is contained in:
parent
c33b6be2bb
commit
37fa75dd77
|
|
@ -997,17 +997,18 @@ ResCheckSimNodes(celldef, resisdata)
|
||||||
|
|
||||||
if (ResOptionsFlags & ResOpt_DoExtFile)
|
if (ResOptionsFlags & ResOpt_DoExtFile)
|
||||||
{
|
{
|
||||||
|
char *alloc = NULL;
|
||||||
if (ExtLocalPath != NULL)
|
if (ExtLocalPath != NULL)
|
||||||
if (strcmp(ExtLocalPath, "."))
|
if (strcmp(ExtLocalPath, "."))
|
||||||
{
|
{
|
||||||
char *namebuf;
|
char *namebuf;
|
||||||
namebuf = mallocMagic(strlen(ExtLocalPath) + strlen(celldef->cd_name)
|
namebuf = alloc = mallocMagic(strlen(ExtLocalPath) + strlen(celldef->cd_name)
|
||||||
+ 2);
|
+ 2);
|
||||||
sprintf(namebuf, "%s/%s", ExtLocalPath, celldef->cd_name);
|
sprintf(namebuf, "%s/%s", ExtLocalPath, celldef->cd_name);
|
||||||
outfile = namebuf;
|
outfile = namebuf;
|
||||||
}
|
}
|
||||||
ResExtFile = PaOpen(outfile, "w", ".res.ext", ".", (char *)NULL, (char **)NULL);
|
ResExtFile = PaOpen(outfile, "w", ".res.ext", ".", (char *)NULL, (char **)NULL);
|
||||||
if (outfile != celldef->cd_name) freeMagic(outfile);
|
if (alloc) freeMagic(alloc);
|
||||||
outfile = celldef->cd_name;
|
outfile = celldef->cd_name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue