From 4efad5388184a2fd76957f0300eeab1a3b1eee2f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 8 Dec 2024 13:17:54 +0100 Subject: [PATCH] main: fix crash on printing -p output Delete a duplicate ucv_put() line that can lead to a double-free bug. Reproduced by running: ucode -l nl80211 -p 'sprintf("%.J\n", nl80211.request(nl80211.const.NL80211_CMD_GET_WIPHY, nl80211.const.NLM_F_DUMP, { wiphy: 0, split_wiphy_dump: true }))' Fixes: 0a7ff4715cb8 ("main: pretty-print `-p` output by default") Signed-off-by: Felix Fietkau --- main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/main.c b/main.c index e7771b7b..1faaba5e 100644 --- a/main.c +++ b/main.c @@ -155,8 +155,6 @@ compile(uc_vm_t *vm, uc_source_t *src, FILE *precompile, bool strip, char *inter fwrite(pb->buf, pb->bpos, 1, stdout); printbuf_free(pb); } - - ucv_put(res); } rc = 0;