aboutsummaryrefslogtreecommitdiffhomepage
path: root/c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-14 21:24:52 +0100
committerlemon <lsof@mailbox.org>2025-12-14 21:24:52 +0100
commit840f60ffded03121ba4ea407e7bef5e89cd3b9bd (patch)
treeaba4de97e123829e599e5dfb7e08de7c80d66ad2 /c
parentd7a5e7520a5213cfaf3e2a5cbaf3a559c45c74fd (diff)
c: fix memory leak if initializer data if error
Diffstat (limited to 'c')
-rw-r--r--c/c.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/c/c.c b/c/c.c
index d96ea5c..49b17b2 100644
--- a/c/c.c
+++ b/c/c.c
@@ -1775,11 +1775,11 @@ initializer(struct comp *cm, union type *ty, enum evalmode ev, bool globl,
p = sec == Srodata ? objout.rodata.p : objout.data.p;
memcpy(p + off, ip->ddat.p, ip->ddat.n);
memset(p + off + ip->ddat.n, 0, typesize(*ty) - ip->ddat.n);
- vfree(&ip->ddat);
for (struct dreloc *rel = ip->drel; rel; rel = rel->link) {
objreloc(rel->sym, targ_64bit ? REL_ABS64 : REL_ABS32, sec, off + rel->off, rel->addend);
}
}
+ vfree(&ip->ddat);
}
dumpini(ip);