aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/scripting-engines/trace-event-perl.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-perl.c')
-rw-r--r--tools/perf/util/scripting-engines/trace-event-perl.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 1d160855cda9..35ed00a600fb 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -283,18 +283,27 @@ static SV *perl_process_callchain(struct perf_sample *sample,
283 if (!elem) 283 if (!elem)
284 goto exit; 284 goto exit;
285 285
286 hv_stores(elem, "ip", newSVuv(node->ip)); 286 if (!hv_stores(elem, "ip", newSVuv(node->ip))) {
287 hv_undef(elem);
288 goto exit;
289 }
287 290
288 if (node->sym) { 291 if (node->sym) {
289 HV *sym = newHV(); 292 HV *sym = newHV();
290 if (!sym) 293 if (!sym) {
294 hv_undef(elem);
295 goto exit;
296 }
297 if (!hv_stores(sym, "start", newSVuv(node->sym->start)) ||
298 !hv_stores(sym, "end", newSVuv(node->sym->end)) ||
299 !hv_stores(sym, "binding", newSVuv(node->sym->binding)) ||
300 !hv_stores(sym, "name", newSVpvn(node->sym->name,
301 node->sym->namelen)) ||
302 !hv_stores(elem, "sym", newRV_noinc((SV*)sym))) {
303 hv_undef(sym);
304 hv_undef(elem);
291 goto exit; 305 goto exit;
292 hv_stores(sym, "start", newSVuv(node->sym->start)); 306 }
293 hv_stores(sym, "end", newSVuv(node->sym->end));
294 hv_stores(sym, "binding", newSVuv(node->sym->binding));
295 hv_stores(sym, "name", newSVpvn(node->sym->name,
296 node->sym->namelen));
297 hv_stores(elem, "sym", newRV_noinc((SV*)sym));
298 } 307 }
299 308
300 if (node->map) { 309 if (node->map) {
@@ -306,7 +315,10 @@ static SV *perl_process_callchain(struct perf_sample *sample,
306 else if (map->dso->name) 315 else if (map->dso->name)
307 dsoname = map->dso->name; 316 dsoname = map->dso->name;
308 } 317 }
309 hv_stores(elem, "dso", newSVpv(dsoname,0)); 318 if (!hv_stores(elem, "dso", newSVpv(dsoname,0))) {
319 hv_undef(elem);
320 goto exit;
321 }
310 } 322 }
311 323
312 callchain_cursor_advance(&callchain_cursor); 324 callchain_cursor_advance(&callchain_cursor);