From: Gert Wollny Date: Thu, 16 Nov 2017 15:09:36 +0000 (+0100) Subject: gallium/aux/util/u_debug_stack.c: Silence -Wunused-result warning X-Git-Tag: upstream/18.1.0~3970 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=373c263e2c3886c88e84d853b9df61ad03d1a8ea;p=platform%2Fupstream%2Fmesa.git gallium/aux/util/u_debug_stack.c: Silence -Wunused-result warning 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 Reviewed-by: Brian Paul (v1) --- diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c index 7013807..6ddacdb 100644 --- a/src/gallium/auxiliary/util/u_debug_stack.c +++ b/src/gallium/auxiliary/util/u_debug_stack.c @@ -90,8 +90,8 @@ symbol_name_cached(unw_cursor_t *cursor, unw_proc_info_t *pip) 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);