Fix: size of concrete class used in memcpy of base class
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 24 Aug 2018 01:51:25 +0000 (21:51 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 24 Aug 2018 01:51:25 +0000 (21:51 -0400)
session rotation condition and evaluation objects' base
class is initialized from a template to set the various
method's function pointers to the functions implementing
their interface.

The memcpy() erroneously uses the "derived" class' size through
sizeof(*obj) rather than the size of the base class through
sizeof(obj->parent).

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/session-rotation.c

index be48a998a98030d41e4cdc49793f3f3579481f4c..0bd91e74fe491f1d188d6ae6b0b322ddb5bd77e7 100644 (file)
@@ -194,7 +194,7 @@ struct lttng_condition *lttng_condition_session_rotation_create(
        }
 
        memcpy(&condition->parent, &rotation_condition_template,
-                       sizeof(*condition));
+                       sizeof(condition->parent));
        lttng_condition_init(&condition->parent, type);
        return &condition->parent;
 }
@@ -341,7 +341,7 @@ struct lttng_evaluation *lttng_evaluation_session_rotation_create(
        }
 
        memcpy(&evaluation->parent, &rotation_evaluation_template,
-                       sizeof(*evaluation));
+                       sizeof(evaluation->parent));
        lttng_evaluation_init(&evaluation->parent, type);
        evaluation->id = id;
        evaluation->location = location;
This page took 0.026222 seconds and 4 git commands to generate.