fix lots of memory leaks
This commit is contained in:
25
src/tag.c
25
src/tag.c
@@ -27,6 +27,8 @@ static enum ec3_status init_seq_write_temp_files(struct ec3_tag_ioctx *tag)
|
||||
}
|
||||
|
||||
cluster_table_init(&tag->io_cluster_table, tag->io_f_cluster_table, 0);
|
||||
cluster_table_init_empty_table(&tag->io_cluster_table);
|
||||
|
||||
return EC3_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -79,8 +81,14 @@ enum ec3_status ec3_tag_ioctx_close(struct ec3_tag_ioctx *tag)
|
||||
enum ec3_tag_ioctx_mode mode = tag->io_mode;
|
||||
tag->io_mode |= EC3_TAG_IO_CLOSED;
|
||||
|
||||
if (tag->io_f_image) {
|
||||
b_file_release(tag->io_f_image);
|
||||
tag->io_f_image = NULL;
|
||||
}
|
||||
|
||||
if (tag->io_cluster_buf) {
|
||||
free(tag->io_cluster_buf);
|
||||
tag->io_cluster_buf = NULL;
|
||||
}
|
||||
|
||||
if (mode & EC3_TAG_IO_WRITE) {
|
||||
@@ -88,6 +96,23 @@ enum ec3_status ec3_tag_ioctx_close(struct ec3_tag_ioctx *tag)
|
||||
return EC3_SUCCESS;
|
||||
}
|
||||
|
||||
if (tag->io_pipeline) {
|
||||
ec3_pipeline_destroy(tag->io_pipeline);
|
||||
tag->io_pipeline = NULL;
|
||||
}
|
||||
|
||||
if (tag->io_f_data) {
|
||||
b_file_release(tag->io_f_data);
|
||||
tag->io_f_data = NULL;
|
||||
}
|
||||
|
||||
if (tag->io_f_cluster_table) {
|
||||
b_file_release(tag->io_f_cluster_table);
|
||||
tag->io_f_cluster_table = NULL;
|
||||
}
|
||||
|
||||
cluster_cache_finish(&tag->io_cache);
|
||||
cluster_table_finish(&tag->io_cluster_table);
|
||||
b_btree_delete(&tag->io_parent->io_opened_tags, &tag->io_node);
|
||||
free(tag);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user