File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1792,8 +1792,10 @@ static const char *cortexar_target_description(target_s *const target)
17921792 const size_t description_length =
17931793 cortexar_build_target_description (NULL , 0 , target -> target_options & TOPT_FLAVOUR_FLOAT ) + 1U ;
17941794 char * const description = malloc (description_length );
1795- if (description )
1796- (void )cortexar_build_target_description (
1797- description , description_length , target -> target_options & TOPT_FLAVOUR_FLOAT );
1795+ if (!description ) { /* malloc failed: heap exhaustion */
1796+ DEBUG_ERROR ("malloc: failed in %s\n" , __func__ );
1797+ return description ;
1798+ }
1799+ cortexar_build_target_description (description , description_length , target -> target_options & TOPT_FLAVOUR_FLOAT );
17981800 return description ;
17991801}
Original file line number Diff line number Diff line change @@ -439,12 +439,14 @@ const char *cortexm_regs_description(target_s *target)
439439 const size_t description_length =
440440 (is_cortexmf ? create_tdesc_cortex_mf (NULL , 0 ) : create_tdesc_cortex_m (NULL , 0 )) + 1U ;
441441 char * const description = malloc (description_length );
442- if (description ) {
443- if (is_cortexmf )
444- create_tdesc_cortex_mf (description , description_length );
445- else
446- create_tdesc_cortex_m (description , description_length );
442+ if (!description ) { /* malloc failed: heap exhaustion */
443+ DEBUG_ERROR ("malloc: failed in %s\n" , __func__ );
444+ return description ;
447445 }
446+ if (is_cortexmf )
447+ create_tdesc_cortex_mf (description , description_length );
448+ else
449+ create_tdesc_cortex_m (description , description_length );
448450 return description ;
449451}
450452
You can’t perform that action at this time.
0 commit comments