File tree Expand file tree Collapse file tree 1 file changed +18
-16
lines changed
Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -444,22 +444,24 @@ static tx_transfer_t* tx_transfer_new(canard_t* const self,
444444 void * const user_context )
445445{
446446 tx_transfer_t * const tr = mem_alloc_zero (self -> mem .tx_transfer , sizeof (tx_transfer_t ));
447- if (tr != NULL ) {
448- FOREACH_IFACE (i ) {
449- tr -> index_pending [i ] = TREE_NULL ;
450- }
451- tr -> index_deadline = TREE_NULL ;
452- tr -> list_agewise = LIST_NULL ;
453- tr -> user_context = user_context ;
454- tr -> deadline = deadline ;
455- tr -> seqno = self -> tx .seqno ++ ;
456- tr -> can_id_msb = (can_id_template >> (29U - CAN_ID_MSb_BITS )) & ((1U << CAN_ID_MSb_BITS ) - 1U );
457- tr -> fd = fd ? 1U : 0U ;
458- tr -> multi_frame = 0U ;
459- tr -> first_frame_departed = 0U ;
460- FOREACH_IFACE (i ) {
461- tr -> cursor [i ] = NULL ;
462- }
447+ if (tr == NULL ) {
448+ self -> err .oom ++ ;
449+ return NULL ;
450+ }
451+ FOREACH_IFACE (i ) {
452+ tr -> index_pending [i ] = TREE_NULL ;
453+ }
454+ tr -> index_deadline = TREE_NULL ;
455+ tr -> list_agewise = LIST_NULL ;
456+ tr -> user_context = user_context ;
457+ tr -> deadline = deadline ;
458+ tr -> seqno = self -> tx .seqno ++ ;
459+ tr -> can_id_msb = (can_id_template >> (29U - CAN_ID_MSb_BITS )) & ((1U << CAN_ID_MSb_BITS ) - 1U );
460+ tr -> fd = fd ? 1U : 0U ;
461+ tr -> multi_frame = 0U ;
462+ tr -> first_frame_departed = 0U ;
463+ FOREACH_IFACE (i ) {
464+ tr -> cursor [i ] = NULL ;
463465 }
464466 return tr ;
465467}
You can’t perform that action at this time.
0 commit comments