Index: lib/libpmc/pmu-events/jevents.c =================================================================== --- lib/libpmc/pmu-events/jevents.c +++ lib/libpmc/pmu-events/jevents.c @@ -794,6 +794,7 @@ if (!mapfp) { pr_info("%s: Error %s opening %s\n", prog, strerror(errno), fpath); + free(line); return -1; } @@ -850,6 +851,8 @@ out: print_mapping_table_suffix(outfp); + free(line); + fclose(mapfp); return 0; }