Fix: string leak when processing of client message fails
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 14 Feb 2016 22:57:19 +0000 (17:57 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 14 Feb 2016 22:57:19 +0000 (17:57 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/main.c

index 7a8b5ae42dcfedb4c7af6a159997d3eaa98dd02f..c8989113a2e9b701f460b92ad189b7e2a3b60189 100644 (file)
@@ -3369,12 +3369,16 @@ skip_domain:
                                ret = -LTTNG_ERR_NOMEM;
                                goto error;
                        }
                                ret = -LTTNG_ERR_NOMEM;
                                goto error;
                        }
+                       cmd_ctx->lsm->u.context.ctx.u.app_ctx.provider_name =
+                                       provider_name;
 
                        context_name = zmalloc(context_name_len + 1);
                        if (!context_name) {
                                ret = -LTTNG_ERR_NOMEM;
                                goto error_add_context;
                        }
 
                        context_name = zmalloc(context_name_len + 1);
                        if (!context_name) {
                                ret = -LTTNG_ERR_NOMEM;
                                goto error_add_context;
                        }
+                       cmd_ctx->lsm->u.context.ctx.u.app_ctx.ctx_name =
+                                       context_name;
 
                        ret = lttcomm_recv_unix_sock(sock, provider_name,
                                        provider_name_len);
 
                        ret = lttcomm_recv_unix_sock(sock, provider_name,
                                        provider_name_len);
@@ -3387,10 +3391,6 @@ skip_domain:
                        if (ret < 0) {
                                goto error_add_context;
                        }
                        if (ret < 0) {
                                goto error_add_context;
                        }
-                       cmd_ctx->lsm->u.context.ctx.u.app_ctx.provider_name =
-                                       provider_name;
-                       cmd_ctx->lsm->u.context.ctx.u.app_ctx.ctx_name =
-                                       context_name;
                }
 
                /*
                }
 
                /*
This page took 0.0365 seconds and 4 git commands to generate.