From: Mathieu Desnoyers Date: Thu, 18 Dec 2014 01:45:15 +0000 (-0500) Subject: Missing error handling: ust_app_ht_alloc should return error status X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=57703f6e0047955a0c68829630fcc42aad988a39 Missing error handling: ust_app_ht_alloc should return error status In preparation for having sessiond main() handle the error. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 3abd12716..9ab5f77e0 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -3438,11 +3438,21 @@ void ust_app_clean_list(void) /* * Init UST app hash table. */ -void ust_app_ht_alloc(void) +int ust_app_ht_alloc(void) { ust_app_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); + if (!ust_app_ht) { + return -1; + } ust_app_ht_by_sock = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); + if (!ust_app_ht_by_sock) { + return -1; + } ust_app_ht_by_notify_sock = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); + if (!ust_app_ht_by_notify_sock) { + return -1; + } + return 0; } /* diff --git a/src/bin/lttng-sessiond/ust-app.h b/src/bin/lttng-sessiond/ust-app.h index d1e260fd1..2d3695cef 100644 --- a/src/bin/lttng-sessiond/ust-app.h +++ b/src/bin/lttng-sessiond/ust-app.h @@ -313,7 +313,7 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess, void ust_app_global_update(struct ltt_ust_session *usess, int sock); void ust_app_clean_list(void); -void ust_app_ht_alloc(void); +int ust_app_ht_alloc(void); struct ust_app *ust_app_find_by_pid(pid_t pid); int ust_app_calibrate_glb(struct lttng_ust_calibrate *calibrate); struct ust_app_stream *ust_app_alloc_stream(void);