common/perf: Fix null pointer dereference
common/perf: Fix null pointer dereference

As pointed out by ColinlanKing[1], perf_profiling_partpause() and
perf_profiling_restore() functions uses pointer 'perf_count_ids'
without checking it for NULL.

Function get_ui_perf_count_map() returns without setting proper
value in 'perf_count_ids' when 'ui_count_id' is UI_COUNT_INVALID.
Right now, there are sufficient pre-checks already present before
calling perf_profiling_partpause() and perf_profiling_restore()
with ui_count_id = UI_COUNT_INVALID. So, user won't face any issue
without this fix. But it's still good to have a check there.

Add a condition to check for NULL pointer before using it.

[1] https://github.com/01org/numatop/issues/36

Reported-by: Colin Ian King <d100aa70785e45ee8deab668147d941941915c21@canonical.com>
Signed-off-by: Ravi Bangoria <c3c2a342b6d0b20c2fffcb500dabb9f78ad28a56@linux.vnet.ibm.com>
Fixes: eb574e79c205 ("Support multiple perf event for one UI parameter")

ColinIanKing/numatop,intel/numatop,ColinIanKing/numatop,ColinIanKing/numatop,01org/numatop,01org/numatop,intel/numatop