mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
tools lib traceevent: Get rid of malloc_or_die() in show_error()
Signed-off-by: Namhyung Kim <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
8f2f5ada71
commit
9451a2fd78
1 changed files with 15 additions and 1 deletions
|
|
@ -56,7 +56,21 @@ static void show_error(char **error_str, const char *fmt, ...)
|
|||
index = pevent_get_input_buf_ptr();
|
||||
len = input ? strlen(input) : 0;
|
||||
|
||||
error = malloc_or_die(MAX_ERR_STR_SIZE + (len*2) + 3);
|
||||
error = malloc(MAX_ERR_STR_SIZE + (len*2) + 3);
|
||||
if (error == NULL) {
|
||||
/*
|
||||
* Maybe it's due to len is too long.
|
||||
* Retry without the input buffer part.
|
||||
*/
|
||||
len = 0;
|
||||
|
||||
error = malloc(MAX_ERR_STR_SIZE);
|
||||
if (error == NULL) {
|
||||
/* no memory */
|
||||
*error_str = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (len) {
|
||||
strcpy(error, input);
|
||||
|
|
|
|||
Loading…
Reference in a new issue