Skip to content

Commit 96799d6

Browse files
committed
Don't free oscap_source when parsing cvrf_xml
Do not free oscap_source when parsing cvrf_xml for index. It should not be the duty of cvrf xml parsing function to free its source of input. Plus, cvrf_index_import is also called in function cvrf_session_new_from_source. In cvrf_session structure, the import source is part of the strucutre along with cvrf index, it make no sense to free it.
1 parent 880ea6a commit 96799d6

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

src/CVRF/cvrf_priv.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2332,7 +2332,6 @@ struct cvrf_index *cvrf_index_parse_xml(struct oscap_source *index_source) {
23322332
}
23332333
struct cvrf_index *index = cvrf_index_new();
23342334
cvrf_index_set_index_file(index, oscap_source_readable_origin(index_source));
2335-
oscap_source_free(index_source);
23362335
return index;
23372336
}
23382337

utils/oscap-cvrf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ static int app_cvrf_export(const struct oscap_action *action) {
151151
if (oscap_err())
152152
fprintf(stderr, "%s %s\n", OSCAP_ERR_MSG, oscap_err_desc());
153153

154-
/* TODO: Refactor, cvrf_index_parse_xml (called by oscap_source_new_from_file) frees its argument as an unexpected side-effect.
155-
* oscap_source_free(import_source);
156-
*/
154+
oscap_source_free(import_source);
157155
free(action->cvrf_action);
158156
return result;
159157
}

0 commit comments

Comments
 (0)