Skip to content
Commit f8ff18be authored by He Zhe's avatar He Zhe Committed by Arnaldo Carvalho de Melo
Browse files

tools lib traceevent: Take care of return value of asprintf



According to the API, if memory allocation wasn't possible, or some
other error occurs, asprintf will return -1, and the contents of strp
below are undefined.

  int asprintf(char **strp, const char *fmt, ...);

This patch takes care of return value of asprintf to make it less error
prone and prevent the following build warning.

  ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: default avatarHe Zhe <zhe.he@windriver.com>
Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: hewenliang4@huawei.com
Link: http://lore.kernel.org/lkml/1582163930-233692-1-git-send-email-zhe.he@windriver.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent bec49a9e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment