Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a couple leaks around event and symbol cleanup #304

Merged
merged 2 commits into from
Jul 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tools/events/ion_event_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,19 @@ iERR ion_event_stream_read_event(hREADER reader, ION_EVENT_READ_PARAMS) {
if (value_imports) {
ion_free_owner(value_imports);
}

// Free string data for the current value_field_name.
if (p_value_field_name) {
free(value_field_name.import_location.name.value);
free(value_field_name.value.value);
}

// Free string data associated with the annotation symbols.
for (std::vector<ION_SYMBOL>::iterator it = value_annotations.begin(); it != value_annotations.end(); it++) {
free(it->value.value);
free(it->import_location.name.value);
}

iRETURN;
}

Expand Down Expand Up @@ -1079,6 +1092,7 @@ iERR ion_event_stream_is_event_stream(hREADER reader, IonEventStream *stream, bo
&& ION_STRING_EQUALS(&ion_event_stream_marker, &symbol_value->value)) {
*is_event_stream = TRUE;
stream->remove(i); // Toss this event -- it's not part of the user data.
delete event;
}
}
else if (event->event_type == STREAM_END) {
Expand Down