Fix: NULL pointer dereference in lttng_condition_serialize
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 7 May 2017 19:51:42 +0000 (15:51 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 7 May 2017 19:51:42 +0000 (15:51 -0400)
Reported-by: Coverity Scan
*** CID 1374823:  Null pointer dereferences  (REVERSE_INULL)

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

index ceab81eabbd81a6928a9b6122a6fdb117940a4b8..98c97a595016c772c54aead040809005f6838be2 100644 (file)
@@ -67,7 +67,8 @@ ssize_t lttng_condition_serialize(const struct lttng_condition *condition,
 {
        ssize_t ret, condition_size;
        struct lttng_condition_comm condition_comm = {
-               .condition_type = (int8_t) condition->type
+               .condition_type = (int8_t) (condition ?
+                               condition->type : LTTNG_CONDITION_TYPE_UNKNOWN)
        };
 
        if (!condition) {
This page took 0.028309 seconds and 4 git commands to generate.