Fix: test presence of override_attr before accessing its member
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 3 Oct 2016 18:57:31 +0000 (14:57 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 7 Oct 2016 17:01:54 +0000 (13:01 -0400)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/lib/lttng-ctl/load.c

index b396b7500f913133963a1360fbaa439bf9844f9e..f89effed04b8b69b23e186dfee6237e8b8cfe10d 100644 (file)
@@ -94,10 +94,12 @@ const char *lttng_load_session_attr_get_override_ctrl_url(
 {
        const char *ret = NULL;
 
-       if (attr && attr->override_attr->ctrl_url) {
-               ret = attr->raw_override_ctrl_url;
+       if (!attr || !attr->override_attr) {
+               goto end;
        }
 
+       ret = attr->raw_override_ctrl_url;
+end:
        return ret;
 }
 
@@ -106,10 +108,12 @@ const char *lttng_load_session_attr_get_override_data_url(
 {
        const char *ret = NULL;
 
-       if (attr && attr->override_attr->data_url) {
-               ret = attr->raw_override_data_url;
+       if (!attr || !attr->override_attr) {
+               goto end;
        }
 
+       ret = attr->raw_override_data_url;
+end:
        return ret;
 }
 
@@ -118,12 +122,16 @@ const char *lttng_load_session_attr_get_override_url(
 {
        const char *ret = NULL;
 
-       if (attr && (attr->override_attr->path_url ||
+       if (!attr || !attr->override_attr) {
+               goto end;
+       }
+
+       if ((attr->override_attr->path_url ||
                (attr->override_attr->ctrl_url &&
                 attr->override_attr->data_url))) {
                ret = attr->raw_override_url;
        }
-
+end:
        return ret;
 }
 
This page took 0.025368 seconds and 4 git commands to generate.