1From b2cc5a1693b17ac415df76d0795b15994c106441 Mon Sep 17 00:00:00 2001
2From: Katsuhiko Gondow <gondow@cs.titech.ac.jp>
3Date: Tue, 13 Jun 2023 05:00:47 +0900
4Subject: [PATCH] Fix memory leak in bin-objfmt (#231)
5
6Upstream-Status: Backport [https://github.com/yasm/yasm/commit/b2cc5a1693b17ac415df76d0795b15994c106441]
7
8CVE: CVE-2023-31975
9---
10 modules/objfmts/bin/bin-objfmt.c | 4 ++++
11 1 file changed, 4 insertions(+)
12
13diff --git a/modules/objfmts/bin/bin-objfmt.c b/modules/objfmts/bin/bin-objfmt.c
14index 18026750..a38c3422 100644
15--- a/modules/objfmts/bin/bin-objfmt.c
16+++ b/modules/objfmts/bin/bin-objfmt.c
17@@ -1680,6 +1680,10 @@ static void
18 bin_section_data_destroy(void *data)
19 {
20     bin_section_data *bsd = (bin_section_data *)data;
21+    if (bsd->align)
22+        yasm_xfree(bsd->align);
23+    if (bsd->valign)
24+        yasm_xfree(bsd->valign);
25     if (bsd->start)
26         yasm_expr_destroy(bsd->start);
27     if (bsd->vstart)
28--
292.40.0
30