From: JP Ikaheimonen Date: Thu, 14 Nov 2013 08:24:33 +0000 (+0200) Subject: Add error check for zmalloc X-Git-Tag: v2.4.0-rc1~13 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5f8df26c87554736946f4e8f163bb070ee68c2cd;p=lttng-tools.git Add error check for zmalloc Report if zmalloc fails in shadow_copy_event. Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index d8adccde2..4912ca6c6 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -1480,8 +1480,11 @@ static void shadow_copy_event(struct ust_app_event *ua_event, exclusion_alloc_size = sizeof(struct lttng_ust_event_exclusion) + LTTNG_UST_SYM_NAME_LEN * uevent->exclusion->count; ua_event->exclusion = zmalloc(exclusion_alloc_size); - if (ua_event->exclusion) { - memcpy(ua_event->exclusion, uevent->exclusion, exclusion_alloc_size); + if (ua_event->exclusion == NULL) { + PERROR("malloc"); + } else { + memcpy(ua_event->exclusion, uevent->exclusion, + exclusion_alloc_size); } } }