@@ -94,7 +94,6 @@ bu_list_item_create(const bu_info_t *bu)
9494 }
9595
9696 item -> bu = (bu_info_t * )bu ;
97- item -> taken_ownership_of_bu = false;
9897 item -> validation_status = get_validation_status_from_bu (bu );
9998 item -> tmp_validation_status = item -> validation_status ;
10099
@@ -111,13 +110,11 @@ bu_list_item_free(bu_list_item_t *item)
111110 }
112111
113112 // If we have |bu| data we free the temporarily used TLV memory slot.
114- if (item -> taken_ownership_of_bu ) {
115- if (item -> bu ) {
116- free (item -> bu -> nalu_data_wo_epb );
117- free (item -> bu -> pending_bu_data );
118- }
119- free (item -> bu );
113+ if (item -> bu ) {
114+ free (item -> bu -> nalu_data_wo_epb );
115+ free (item -> bu -> pending_bu_data );
120116 }
117+ free (item -> bu );
121118 free (item );
122119}
123120
@@ -161,7 +158,6 @@ bu_list_item_print(const bu_list_item_t *item)
161158 // bu_info_t *bu;
162159 // char validation_status;
163160 // uint8_t hash[MAX_HASH_SIZE];
164- // bool taken_ownership_of_bu;
165161 // bool has_been_decoded;
166162 // bool used_in_gop_hash;
167163
@@ -176,8 +172,7 @@ bu_list_item_print(const bu_list_item_t *item)
176172 memcpy (validation_status_str , & item -> tmp_validation_status , 1 );
177173
178174 printf ("BU type = %s\n" , bu_type_str );
179- printf ("validation_status = %s%s%s%s\n" , validation_status_str ,
180- (item -> taken_ownership_of_bu ? ", taken_ownership_of_bu" : "" ),
175+ printf ("validation_status = %s%s%s\n" , validation_status_str ,
181176 (item -> has_been_decoded ? ", has_been_decoded" : "" ),
182177 (item -> used_in_gop_hash ? ", used_in_gop_hash" : "" ));
183178 sv_print_hex_data (item -> hash , item -> hash_size , "item->hash " );
@@ -395,16 +390,7 @@ bu_list_copy_last_item(bu_list_t *list, bool hash_algo_known)
395390 }
396391 SV_DONE (status )
397392
398- if (item -> taken_ownership_of_bu ) {
399- // We have taken ownership of the existing |bu|, hence we need to free it when releasing it.
400- // NOTE: This should not happen if the list is used properly.
401- if (item -> bu ) {
402- free (item -> bu -> nalu_data_wo_epb );
403- }
404- free (item -> bu );
405- }
406393 item -> bu = copied_bu ;
407- item -> taken_ownership_of_bu = true;
408394
409395 return status ;
410396}
0 commit comments