diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2015-09-21 16:21:20 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2015-09-22 12:51:55 -0400 |
commit | 32818c104b935c2f5d30c4568032cc27862521d1 (patch) | |
tree | 9055b19e4016458f35022b4e759628adff0a9268 | |
parent | 68f3161e8d5d9db04538a6eb51c30dd912bbbe7a (diff) | |
download | trace-cmd-32818c104b935c2f5d30c4568032cc27862521d1.tar.gz |
trace-cmd stat: Remove malloc_or_die()
Fail with a more descriptive message when failing to allocate.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-stat.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/trace-stat.c b/trace-stat.c index 0f1610ec..adbf3c3e 100644 --- a/trace-stat.c +++ b/trace-stat.c @@ -74,9 +74,9 @@ char *append_file(const char *dir, const char *name) { char *file; - file = malloc_or_die(strlen(dir) + strlen(name) + 2); + file = malloc(strlen(dir) + strlen(name) + 2); if (!file) - die("malloc"); + die("Failed to allocate %s/%s", dir, name); sprintf(file, "%s/%s", dir, name); return file; @@ -158,7 +158,9 @@ struct event_iter *trace_event_iter_alloc(const char *path) { struct event_iter *iter; - iter = malloc_or_die(sizeof(*iter)); + iter = malloc(sizeof(*iter)); + if (!iter) + die("Failed to allocate event_iter for path %s", path); memset(iter, 0, sizeof(*iter)); iter->system_dir = opendir(path); |