From d9e2315039bb22f7086aa4c9eda629f9f6e82b91 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 05 Jul 2023 21:40:16 -0400 Subject: opk/write: Fix memory leaks opk->temp_file_name wasn't freed when either of the _opkg_opk_opk_build_inner_archive() calls failed. Fixes: Direct leak of 73 byte(s) in 1 object(s) allocated from: #0 0x7fde9c5c4d28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28) #1 0x563aeebbc4e8 in opkg_opk_opk_write src/opk/write.c:512 #2 0x563aeebb4351 in main src/main.c:357 #3 0x7fde9bc5b2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) --- diff --git a/src/opk/write.c b/src/opk/write.c index ae8a799..284b625 100644 --- a/src/opk/write.c +++ b/src/opk/write.c @@ -519,13 +519,13 @@ opkg_opk_opk_write(struct opkg_opk_opk *opk, const char *file_name) OPKG_OPK_OPK_ARCHIVE_TYPE_CONTROL_) != OPKG_OPK_OK) { ret = OPKG_OPK_ERROR; - goto out4; + goto out5; } if (_opkg_opk_opk_build_inner_archive(opk, OPKG_OPK_OPK_ARCHIVE_TYPE_DATA_) != OPKG_OPK_OK) { ret = OPKG_OPK_ERROR; - goto out4; + goto out5; } /* Write trailer. */ -- cgit v0.9.1