perf maps: Add missing unlock to maps__insert() error case
authorCengiz Can <cengiz@kernel.wtf>
Mon, 20 Jan 2020 14:15:54 +0000 (17:15 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 31 Jan 2020 08:40:50 +0000 (09:40 +0100)
commit85fc95d75970ee7dd8e01904e7fb1197c275ba6b
tree11a21f28a52973364bba9ac928f4809c90eef8dd
parent1873f1547dde65c687de143938581347a9312207
perf maps: Add missing unlock to maps__insert() error case

`tools/perf/util/map.c` has a function named `maps__insert` that
acquires a write lock if its in multithread context.

Even though this lock is released when function successfully completes,
there's a branch that is executed when `maps_by_name == NULL` that
returns from this function without releasing the write lock.

Added an `up_write` to release the lock when this happens.

Fixes: a7c2b572e217 ("perf map_groups: Auto sort maps by name, if needed")
Signed-off-by: Cengiz Can <cengiz@kernel.wtf>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/lkml/20200120141553.23934-1-cengiz@kernel.wtf
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/map.c