Skip to content

Commit d1eec53

Browse files
authoredMar 7, 2025
Merge pull request #428 from bart-kroon/fix-double-free
Avoid double free of roi.file_path
2 parents 8ecce84 + 3804d8a commit d1eec53

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ configure.scan
5454
src/kvazaar
5555
src/libkvazaar.so.*
5656
src/kvazaar.pc
57+
src/kvazaar.pc.temp
5758
src/version.h
5859
tests/kvazaar_tests
5960
tests/kvazaar_tests.trs

‎src/encoder.c

+6
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ encoder_control_t* kvz_encoder_control_init(const kvz_config *const cfg)
153153

154154
// Take a copy of the config.
155155
memcpy(&encoder->cfg, cfg, sizeof(encoder->cfg));
156+
157+
// Copy the ROI file path
158+
if (cfg->roi.file_path) {
159+
encoder->cfg.roi.file_path = strdup(cfg->roi.file_path);
160+
}
161+
156162
// Set fields that are not copied to NULL.
157163
encoder->cfg.cqmfile = NULL;
158164
encoder->cfg.tiles_width_split = NULL;

0 commit comments

Comments
 (0)