From: Mathieu Desnoyers Date: Thu, 22 Nov 2012 17:28:49 +0000 (-0500) Subject: Fix: filter linking can dereference NULL pointer on alloc failure X-Git-Tag: v2.1.0-rc2~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e0a7d7abdd07d018d6ac7ba104b2b73ae76c7ad6;p=lttng-ust.git Fix: filter linking can dereference NULL pointer on alloc failure Reported-by: Christian Babeux Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-filter.c b/liblttng-ust/lttng-filter.c index 62a745f1..11e7e376 100644 --- a/liblttng-ust/lttng-filter.c +++ b/liblttng-ust/lttng-filter.c @@ -254,7 +254,7 @@ int _lttng_filter_event_link_bytecode(struct lttng_event *event, runtime = zmalloc(runtime_alloc_len); if (!runtime) { ret = -ENOMEM; - goto link_error; + goto alloc_error; } runtime->p.bc = filter_bytecode; runtime->len = filter_bytecode->bc.reloc_offset; @@ -298,6 +298,7 @@ link_error: runtime->p.filter = lttng_filter_false; runtime->p.link_failed = 1; cds_list_add_rcu(&runtime->p.node, insert_loc); +alloc_error: dbg_printf("Linking failed.\n"); return ret; }