diff options
author | Jiri Olsa <jolsa@redhat.com> | 2013-12-03 08:09:36 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-04 13:35:48 -0500 |
commit | f9bb36afb25d3bfda1c9276a55985b710c8a91ae (patch) | |
tree | ecda01c9a84d6ac71ee7b02ddd3a6d6ecf233fb2 /tools | |
parent | 943714737374635a134dc3de59a7f062cea53fb3 (diff) |
tools lib traceevent: Remove malloc_or_die from event-plugin.c
Removing malloc_or_die calls from event-plugin.c,
replacing them with standard malloc and error path.
Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386076182-14484-23-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/traceevent/event-plugin.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/lib/traceevent/event-plugin.c b/tools/lib/traceevent/event-plugin.c index d272d87aa7d4..125f5676bcb5 100644 --- a/tools/lib/traceevent/event-plugin.c +++ b/tools/lib/traceevent/event-plugin.c | |||
@@ -47,7 +47,11 @@ load_plugin(struct pevent *pevent, const char *path, | |||
47 | char *plugin; | 47 | char *plugin; |
48 | void *handle; | 48 | void *handle; |
49 | 49 | ||
50 | plugin = malloc_or_die(strlen(path) + strlen(file) + 2); | 50 | plugin = malloc(strlen(path) + strlen(file) + 2); |
51 | if (!plugin) { | ||
52 | warning("could not allocate plugin memory\n"); | ||
53 | return; | ||
54 | } | ||
51 | 55 | ||
52 | strcpy(plugin, path); | 56 | strcpy(plugin, path); |
53 | strcat(plugin, "/"); | 57 | strcat(plugin, "/"); |
@@ -71,7 +75,12 @@ load_plugin(struct pevent *pevent, const char *path, | |||
71 | goto out_free; | 75 | goto out_free; |
72 | } | 76 | } |
73 | 77 | ||
74 | list = malloc_or_die(sizeof(*list)); | 78 | list = malloc(sizeof(*list)); |
79 | if (!list) { | ||
80 | warning("could not allocate plugin memory\n"); | ||
81 | goto out_free; | ||
82 | } | ||
83 | |||
75 | list->next = *plugin_list; | 84 | list->next = *plugin_list; |
76 | list->handle = handle; | 85 | list->handle = handle; |
77 | list->name = plugin; | 86 | list->name = plugin; |
@@ -163,7 +172,11 @@ load_plugins(struct pevent *pevent, const char *suffix, | |||
163 | if (!home) | 172 | if (!home) |
164 | return; | 173 | return; |
165 | 174 | ||
166 | path = malloc_or_die(strlen(home) + strlen(LOCAL_PLUGIN_DIR) + 2); | 175 | path = malloc(strlen(home) + strlen(LOCAL_PLUGIN_DIR) + 2); |
176 | if (!path) { | ||
177 | warning("could not allocate plugin memory\n"); | ||
178 | return; | ||
179 | } | ||
167 | 180 | ||
168 | strcpy(path, home); | 181 | strcpy(path, home); |
169 | strcat(path, "/"); | 182 | strcat(path, "/"); |