summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-06-12 20:01:53 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-06-12 20:01:53 -0600
commit28c8e08b08eea3b6c146f41829244a23524893a5 (patch)
tree9764b1c785e97c6fbf7a418bbe912a0e05103dc1
parent0474953ab2600ee3b6bc17ba605b8e7877e181fe (diff)
parented116aceb41a80a212bb67e49716bbd40d88a3a1 (diff)
Merge branch 'lukeshu/fix-leak'HEADmain
-rw-r--r--cmd/sbc_harness/fs_harness_flash_bin.c3
-rw-r--r--cmd/sbc_harness/ihex.c6
-rw-r--r--cmd/sbc_harness/ihex.h1
3 files changed, 10 insertions, 0 deletions
diff --git a/cmd/sbc_harness/fs_harness_flash_bin.c b/cmd/sbc_harness/fs_harness_flash_bin.c
index 6ae9e77..510a247 100644
--- a/cmd/sbc_harness/fs_harness_flash_bin.c
+++ b/cmd/sbc_harness/fs_harness_flash_bin.c
@@ -284,6 +284,9 @@ static void flash_file_iofree(struct flash_file *self) {
error err = flashio_close(&self->io);
assert(ERROR_IS_NULL(err));
+
+ err = ihex_decoder_close(&self->ihex);
+ assert(ERROR_IS_NULL(err));
}
static error flash_file_pread(struct flash_file *self, struct lib9p_srv_ctx *ctx,
diff --git a/cmd/sbc_harness/ihex.c b/cmd/sbc_harness/ihex.c
index 565ad16..5a7f6d5 100644
--- a/cmd/sbc_harness/ihex.c
+++ b/cmd/sbc_harness/ihex.c
@@ -15,6 +15,7 @@
#include "ihex.h"
LO_IMPLEMENTATION_C(io_writer, struct ihex_decoder, ihex_decoder);
+LO_IMPLEMENTATION_C(io_closer, struct ihex_decoder, ihex_decoder);
enum ihex_record_type {
/* [U]SBA: [Upper] Segment Base Address : SBA = USBA<< 4 */
@@ -223,3 +224,8 @@ size_t_and_error ihex_decoder_writev(struct ihex_decoder *self, const struct iov
}
return ERROR_AND(size_t, total, ERROR_NULL);
}
+
+error ihex_decoder_close(struct ihex_decoder *self) {
+ error_cleanup(&self->sticky_err);
+ return ERROR_NULL;
+}
diff --git a/cmd/sbc_harness/ihex.h b/cmd/sbc_harness/ihex.h
index d5ac70c..35a3cbe 100644
--- a/cmd/sbc_harness/ihex.h
+++ b/cmd/sbc_harness/ihex.h
@@ -44,5 +44,6 @@ struct ihex_decoder {
END_PRIVATE(IHEX_H);
};
LO_IMPLEMENTATION_H(io_writer, struct ihex_decoder, ihex_decoder);
+LO_IMPLEMENTATION_H(io_closer, struct ihex_decoder, ihex_decoder);
#endif /* _SBC_HARNESS_IHEX_H_ */