From: Mathieu Desnoyers Date: Fri, 24 Jun 2011 02:16:35 +0000 (-0400) Subject: Fix uninitialized return variable in error path for contexts X-Git-Tag: v2.0-pre1~40 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=09fec6b43d11b3e0ece36f9e9e44b9627c1b565d;p=lttng-modules.git Fix uninitialized return variable in error path for contexts Signed-off-by: Mathieu Desnoyers --- diff --git a/lttng-context-comm.c b/lttng-context-comm.c index 6e51bf85..ede3f51a 100644 --- a/lttng-context-comm.c +++ b/lttng-context-comm.c @@ -41,11 +41,10 @@ void comm_record(struct lttng_ctx_field *field, int lttng_add_comm_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; - int ret; field = lttng_append_context(ctx); if (!field) - return ret; + return -ENOMEM; field->event_field.name = "comm"; field->event_field.type.atype = atype_array; field->event_field.type.u.array.elem_type.atype = atype_integer; diff --git a/lttng-context-nice.c b/lttng-context-nice.c index d7fafb9d..bfe688ef 100644 --- a/lttng-context-nice.c +++ b/lttng-context-nice.c @@ -40,11 +40,10 @@ void nice_record(struct lttng_ctx_field *field, int lttng_add_nice_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; - int ret; field = lttng_append_context(ctx); if (!field) - return ret; + return -ENOMEM; field->event_field.name = "nice"; field->event_field.type.atype = atype_integer; field->event_field.type.u.basic.integer.size = sizeof(int) * CHAR_BIT; diff --git a/lttng-context-pid.c b/lttng-context-pid.c index 5400db96..ee2c4f0f 100644 --- a/lttng-context-pid.c +++ b/lttng-context-pid.c @@ -40,11 +40,10 @@ void pid_record(struct lttng_ctx_field *field, int lttng_add_pid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; - int ret; field = lttng_append_context(ctx); if (!field) - return ret; + return -ENOMEM; field->event_field.name = "pid"; field->event_field.type.atype = atype_integer; field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT; diff --git a/lttng-context-ppid.c b/lttng-context-ppid.c index 342aa343..9f647ab1 100644 --- a/lttng-context-ppid.c +++ b/lttng-context-ppid.c @@ -43,11 +43,10 @@ void ppid_record(struct lttng_ctx_field *field, int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; - int ret; field = lttng_append_context(ctx); if (!field) - return ret; + return -ENOMEM; field->event_field.name = "ppid"; field->event_field.type.atype = atype_integer; field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT; diff --git a/lttng-context-prio.c b/lttng-context-prio.c index d159e02d..842717ca 100644 --- a/lttng-context-prio.c +++ b/lttng-context-prio.c @@ -63,7 +63,7 @@ int lttng_add_prio_to_ctx(struct lttng_ctx **ctx) field = lttng_append_context(ctx); if (!field) - return ret; + return -ENOMEM; field->event_field.name = "prio"; field->event_field.type.atype = atype_integer; field->event_field.type.u.basic.integer.size = sizeof(int) * CHAR_BIT; diff --git a/lttng-context-tid.c b/lttng-context-tid.c index 4e974f8d..f207d986 100644 --- a/lttng-context-tid.c +++ b/lttng-context-tid.c @@ -40,11 +40,10 @@ void tid_record(struct lttng_ctx_field *field, int lttng_add_tid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; - int ret; field = lttng_append_context(ctx); if (!field) - return ret; + return -ENOMEM; field->event_field.name = "tid"; field->event_field.type.atype = atype_integer; field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT; diff --git a/lttng-context-vpid.c b/lttng-context-vpid.c index 3bbb87f4..c99010cf 100644 --- a/lttng-context-vpid.c +++ b/lttng-context-vpid.c @@ -40,11 +40,10 @@ void vpid_record(struct lttng_ctx_field *field, int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; - int ret; field = lttng_append_context(ctx); if (!field) - return ret; + return -ENOMEM; field->event_field.name = "vpid"; field->event_field.type.atype = atype_integer; field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT; diff --git a/lttng-context-vppid.c b/lttng-context-vppid.c index 813ccc61..d55e12db 100644 --- a/lttng-context-vppid.c +++ b/lttng-context-vppid.c @@ -43,11 +43,10 @@ void vppid_record(struct lttng_ctx_field *field, int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; - int ret; field = lttng_append_context(ctx); if (!field) - return ret; + return -ENOMEM; field->event_field.name = "vppid"; field->event_field.type.atype = atype_integer; field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT; diff --git a/lttng-context-vtid.c b/lttng-context-vtid.c index 665e1a9c..f81fff63 100644 --- a/lttng-context-vtid.c +++ b/lttng-context-vtid.c @@ -44,7 +44,7 @@ int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx) field = lttng_append_context(ctx); if (!field) - return ret; + return -ENOMEM; field->event_field.name = "vtid"; field->event_field.type.atype = atype_integer; field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;