Skip to content

Commit

Permalink
[C-API] Bugfix for ml_pipeline_element_get_handle
Browse files Browse the repository at this point in the history
Need to ref element obtained by iterate_element() and unref it in cleanup_node() for common_elem

- common_elem by ml_pipeline_element_get_handle() need to unref in cleaunup_node() because g_hash_table_lookup assign new memory.
  but normal operation, unref is not necessary, so add ref in iterate_element()
- Now, the element's finalize function is called after ml_pipeline_element_get_handle()

Signed-off-by: hyunil park <hyunil46.park@samsung.com>
  • Loading branch information
songgot committed Aug 28, 2023
1 parent 85ef49a commit 4a3600a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion c/src/ml-api-inference-pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,8 @@ cleanup_node (gpointer data)
if (e->sink)
gst_object_unref (e->sink);

g_object_unref (e->element);

_ml_tensors_info_free (&e->tensors_info);

g_mutex_unlock (&e->lock);
Expand Down Expand Up @@ -915,7 +917,8 @@ iterate_element (ml_pipeline * pipe_h, GstElement * pipeline,
if (element_type != ML_PIPELINE_ELEMENT_UNKNOWN) {
ml_pipeline_element *e;

e = construct_element (elem, pipe_h, name, element_type);
e = construct_element (gst_object_ref (elem), pipe_h, name,
element_type);
if (e != NULL) {
if (g_str_equal (element_name, "tensor_if"))
process_tensor_if_option (e);
Expand Down

0 comments on commit 4a3600a

Please sign in to comment.