mcstrans/backport-mcstrans-free-constraint-in-error-branch.patch
yixiangzhike 06818ae19a use macro autosetup instead of patchN for merging patch file
(cherry picked from commit 6b310afb07efcb38841220d9ba2b30ce25e57ffb)
2025-02-19 16:53:13 +08:00

33 lines
954 B
Diff

From 55b474ee41034e7cec38cf7b739c2a5c5a7886c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Mon, 29 Apr 2024 18:39:01 +0200
Subject: [PATCH] mcstrans: free constraint in error branch
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Free constraint, like in all other error branches.
Reported-by: Cppcheck
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
---
src/mcstrans.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mcstrans.c b/src/mcstrans.c
index fded3235..7667e131 100644
--- a/src/mcstrans.c
+++ b/src/mcstrans.c
@@ -477,6 +477,7 @@ add_constraint(char op, char *raw, char *tok) {
}
if (asprintf(&constraint->text, "%s%c%s", raw, op, tok) < 0) {
log_error("asprintf failed %s", strerror(errno));
+ free(constraint);
return -1;
}
constraint->op = op;
--
2.33.0