Fix memory leak in srcpos_verror()
Since dtc runs are short, we don't care that much about memory leaks. Still, leaking the source position string every time we print an error messages is pretty nasty. Fix it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
e19d3b1d6d
commit
0c0bf8519a
1 changed files with 3 additions and 1 deletions
4
srcpos.c
4
srcpos.c
|
@ -293,13 +293,15 @@ srcpos_string(struct srcpos *pos)
|
||||||
void
|
void
|
||||||
srcpos_verror(struct srcpos *pos, const char *fmt, va_list va)
|
srcpos_verror(struct srcpos *pos, const char *fmt, va_list va)
|
||||||
{
|
{
|
||||||
const char *srcstr;
|
char *srcstr;
|
||||||
|
|
||||||
srcstr = srcpos_string(pos);
|
srcstr = srcpos_string(pos);
|
||||||
|
|
||||||
fprintf(stderr, "Error: %s ", srcstr);
|
fprintf(stderr, "Error: %s ", srcstr);
|
||||||
vfprintf(stderr, fmt, va);
|
vfprintf(stderr, fmt, va);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
|
free(srcstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue