Skip to content

Commit

Permalink
fixed segmentation fault when calling "audit perf" command
Browse files Browse the repository at this point in the history
In this patch added an initialization pointers "time_in_opp_t0",
"time_in_opp_t1", "time_in_opp_cnt" with value NULL at the beginning
of the function "audit_performances".
Because if the function "cpufreq_opp_nbr_get" returns 0
(file ".../time_in_state" is absent), then the memory for them
is not allocated (pointers are remain uninitialized) and attempt
to release allocated memory for them in the end of the function
"audit_performances" results in segmentation fault.

Signed-off-by: Oleksandr_Tyshchenko <oleksandr.tyshchenko@ti.com>
  • Loading branch information
Oleksandr_Tyshchenko authored and Patrick Titiano committed Oct 9, 2012
1 parent e246880 commit 904ea26
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions common/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ int audit_performances(FILE *stream, unsigned int duration, unsigned int delay)
unsigned int emif_delta_cycles,
emif_delta_busy_cycles;
double emif_load;
uint64_t *time_in_opp_t0;
uint64_t *time_in_opp_t1;
uint64_t *time_in_opp_cnt;
uint64_t *time_in_opp_t0 = NULL;
uint64_t *time_in_opp_t1 = NULL;
uint64_t *time_in_opp_cnt = NULL;
uint64_t total_trans_t0, total_trans_t1, total_trans_cnt;
unsigned int i;
uint64_t sec, msec, usec, active_c0_time;
Expand Down

0 comments on commit 904ea26

Please sign in to comment.