lkml.org 
[lkml]   [2012]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3/3] perf: Check for valid dso before creating map
    From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>

    dso__new() can return NULL. Hence verify dso before creating
    a new map.

    Suggested-by: Arnaldo Carvalho de Melo <acme@infradead.org>
    Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
    ---
    tools/perf/util/symbol.c | 5 ++++-
    1 files changed, 4 insertions(+), 1 deletions(-)

    diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
    index e2ba885..0ef529e 100644
    --- a/tools/perf/util/symbol.c
    +++ b/tools/perf/util/symbol.c
    @@ -2786,8 +2786,11 @@ int machine__load_vmlinux_path(struct machine *machine, enum map_type type,

    struct map *dso__new_map(const char *name)
    {
    + struct map *map = NULL;
    struct dso *dso = dso__new(name);
    - struct map *map = map__new2(0, dso, MAP__FUNCTION);
    +
    + if (dso)
    + map = map__new2(0, dso, MAP__FUNCTION);

    return map;
    }



    \
     
     \ /
      Last update: 2012-05-31 14:21    [W:4.271 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site