asprintf is decorated with the attrbute "warn_unused_result", and if the
function call fails, the pointer "temp" will be undefined, but since it is
used later it should contain some usable value.
Test return value of asprintf and assign some save value to "temp" if
the call failed.
Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
procname[1] = 0;
}
- asprintf(&name, "%s%s", procname, ret == -UNW_ENOMEM ? "..." : "");
-
+ if (asprintf(&name, "%s%s", procname, ret == -UNW_ENOMEM ? "..." : "") == -1)
+ name = "??";
util_hash_table_set(symbols_hash, addr, (void*)name);
}
mtx_unlock(&symbols_mutex);