[lttng-dev] [PATCH lttng-tools] Fix: ust-app null pointer check needed for main refactoring
Jérémie Galarneau
jeremie.galarneau at efficios.com
Wed Jan 7 16:10:53 EST 2015
Merged, thanks!
Jérémie
On Mon, Jan 5, 2015 at 3:05 PM, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
> src/bin/lttng-sessiond/ust-app.c | 42 ++++++++++++++++++++++++++--------------
> 1 file changed, 27 insertions(+), 15 deletions(-)
>
> diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
> index 9ab5f77..bc1d62d 100644
> --- a/src/bin/lttng-sessiond/ust-app.c
> +++ b/src/bin/lttng-sessiond/ust-app.c
> @@ -3408,31 +3408,43 @@ void ust_app_clean_list(void)
>
> rcu_read_lock();
>
> - cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
> - ret = lttng_ht_del(ust_app_ht, &iter);
> - assert(!ret);
> - call_rcu(&app->pid_n.head, delete_ust_app_rcu);
> + if (ust_app_ht) {
> + cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
> + ret = lttng_ht_del(ust_app_ht, &iter);
> + assert(!ret);
> + call_rcu(&app->pid_n.head, delete_ust_app_rcu);
> + }
> }
>
> /* Cleanup socket hash table */
> - cds_lfht_for_each_entry(ust_app_ht_by_sock->ht, &iter.iter, app,
> - sock_n.node) {
> - ret = lttng_ht_del(ust_app_ht_by_sock, &iter);
> - assert(!ret);
> + if (ust_app_ht_by_sock) {
> + cds_lfht_for_each_entry(ust_app_ht_by_sock->ht, &iter.iter, app,
> + sock_n.node) {
> + ret = lttng_ht_del(ust_app_ht_by_sock, &iter);
> + assert(!ret);
> + }
> }
>
> /* Cleanup notify socket hash table */
> - cds_lfht_for_each_entry(ust_app_ht_by_notify_sock->ht, &iter.iter, app,
> - notify_sock_n.node) {
> - ret = lttng_ht_del(ust_app_ht_by_notify_sock, &iter);
> - assert(!ret);
> + if (ust_app_ht_by_notify_sock) {
> + cds_lfht_for_each_entry(ust_app_ht_by_notify_sock->ht, &iter.iter, app,
> + notify_sock_n.node) {
> + ret = lttng_ht_del(ust_app_ht_by_notify_sock, &iter);
> + assert(!ret);
> + }
> }
> rcu_read_unlock();
>
> /* Destroy is done only when the ht is empty */
> - ht_cleanup_push(ust_app_ht);
> - ht_cleanup_push(ust_app_ht_by_sock);
> - ht_cleanup_push(ust_app_ht_by_notify_sock);
> + if (ust_app_ht) {
> + ht_cleanup_push(ust_app_ht);
> + }
> + if (ust_app_ht_by_sock) {
> + ht_cleanup_push(ust_app_ht_by_sock);
> + }
> + if (ust_app_ht_by_notify_sock) {
> + ht_cleanup_push(ust_app_ht_by_notify_sock);
> + }
> }
>
> /*
> --
> 2.1.1
>
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list