Thanks much to Gary Mohr for the patch:
Thanks much to Gary Mohr for the patch:

  This patch fixes a problem in the perf_events component that
  could cause get event info to produce incorrect results.
  The problem was reported by Harold Servat and occurs when the
  functions PAPI_event_name_to_code and PAPI_get_event_info are
  called for an event with a mask (name:mask) and then called
  again for the event without a mask (name). When this is done the
  second call to PAPI_get_event_info will incorrectly return the
  event name and mask from the first call (name:mask).

  This patch also corrects a problem found with valgrind which was
  causing memory on the heap to get stranded.  We were passing
  a char **event_string to the libpfm4 encode function and he was
  allocating some memory and giving us back a pointer to the
  allocated space.  The code in PAPI was responsible for freeing
  this space but failed to do so.  After looking closer at the
  PAPI code, it does not need the information returned in this
  space so the patch changes the code to not ask for the
  information so that libpfm4 no longer allocates heap space.

arm-hpc/papi,arm-hpc/papi,arm-hpc/papi,arm-hpc/papi,arm-hpc/papi,arm-hpc/papi,arm-hpc/papi