Skip to contentSkip to conversation

tools: image-host: Fix potential memory leak

PATCH New [email protected] 1 participant 1 message Apr 18, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: image-host: Fix potential memory leak

From: Maks Mishin <[email protected]>

---
 tools/image-host.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/image-host.c +5 -2
index 4a24dee8..453cd38f 100644
@@ -1029,10 +1029,13 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile,
 				   &region_proplen))
 		return -1;
 
-	if (fit_image_setup_sig(&info, keydir, keyfile, fit, conf_name, noffset,
+	ret = fit_image_setup_sig(&info, keydir, keyfile, fit, conf_name, noffset,
 				require_keys ? "conf" : NULL, engine_id,
-				algo_name))
+				algo_name);
+	if (ret) {
+		free(info.name);
 		return -1;
+	}
 
 	ret = info.crypto->sign(&info, region, region_count, &value,
 				&value_len);
Signature · 1 line
2.34.1