@@ -185,7 +185,7 @@ pipe_custom_remove_data (const pipe_custom_type_e type, const gchar * name)
185185
186186 g_ml_custom_data = g_list_delete_link (g_ml_custom_data , link );
187187
188- g_free ( data -> name );
188+ g_clear_pointer ( & data -> name , g_free );
189189 g_free (data );
190190 }
191191
@@ -516,7 +516,7 @@ free_element_handle (gpointer data)
516516 NULL , NULL );
517517 }
518518
519- g_free ( item -> callback_info );
519+ g_clear_pointer ( & item -> callback_info , g_free );
520520 item -> callback_info = NULL ;
521521 g_free (item );
522522}
@@ -576,7 +576,7 @@ cleanup_node (gpointer data)
576576 e -> custom_destroy (e -> custom_data , e );
577577 }
578578
579- g_free ( e -> name );
579+ g_clear_pointer ( & e -> name , g_free );
580580 if (e -> src )
581581 gst_object_unref (e -> src );
582582 if (e -> sink )
@@ -605,7 +605,7 @@ cleanup_resource (gpointer data)
605605 release_tizen_resource (res -> handle , res -> type );
606606 }
607607
608- g_free ( res -> type );
608+ g_clear_pointer ( & res -> type , g_free );
609609 g_free (res );
610610}
611611
@@ -2137,8 +2137,7 @@ ml_pipeline_switch_get_pad_list (ml_pipeline_switch_h h, char ***list)
21372137
21382138 if (i > counter ) {
21392139 g_list_free_full (dllist , g_free ); /* This frees all strings as well */
2140- g_free (* list );
2141- * list = NULL ;
2140+ g_clear_pointer (list , g_free );
21422141
21432142 _ml_error_report
21442143 ("Internal data inconsistency. This could be a bug in nnstreamer. Switch [%s]." ,
@@ -2746,7 +2745,7 @@ ml_pipeline_custom_free_handle (ml_custom_filter_s * custom)
27462745 if (custom ) {
27472746 g_mutex_lock (& custom -> lock );
27482747
2749- g_free ( custom -> name );
2748+ g_clear_pointer ( & custom -> name , g_free );
27502749 ml_tensors_info_destroy (custom -> in_info );
27512750 ml_tensors_info_destroy (custom -> out_info );
27522751
@@ -2808,7 +2807,9 @@ ml_pipeline_custom_invoke (void *data, const GstTensorFilterProperties * prop,
28082807 g_mutex_unlock (& c -> lock );
28092808 /* NOTE: DO NOT free tensor data */
28102809 _ml_tensors_data_destroy_internal (in_data , FALSE);
2810+ in_data = NULL ;
28112811 _ml_tensors_data_destroy_internal (out_data , FALSE);
2812+ out_data = NULL ;
28122813
28132814 return status ;
28142815}
@@ -3056,7 +3057,7 @@ ml_pipeline_if_custom_free (ml_if_custom_s * custom)
30563057 if (custom ) {
30573058 g_mutex_lock (& custom -> lock );
30583059
3059- g_free ( custom -> name );
3060+ g_clear_pointer ( & custom -> name , g_free );
30603061
30613062 g_mutex_unlock (& custom -> lock );
30623063 g_mutex_clear (& custom -> lock );
0 commit comments