Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: avoid double-free in build_index_from_idx_file
If the validation at the end of build_index_from_idx_file fails, the index_entry variable will still point to the last processed index entry. That same entry will also have been added to the index->entries array. In the error path, we free index_entry and the index object, which frees that index entry twice. Fix it by clearing index_entry after adding the entry to the index object (the ownership is conceptually transferred). I don't add a test with this patch, because the file that triggers this bug now hits a bug further in the processing. That file will be added in the testsuite when it will no longer make babeltrace crash. Change-Id: I091785895541105273c5d07d49f35628c2682e30 Signed-off-by: Simon Marchi <[email protected]> Reviewed-on: https://review.lttng.org/c/babeltrace/+/2211 Reviewed-by: Francis Deslauriers <[email protected]> CI-Build: Francis Deslauriers <[email protected]> Tested-by: jenkins <[email protected]>
- Loading branch information