Fix: sessiond ht_match_event() check if filter is NULL
[lttng-tools.git] / src / bin / lttng-sessiond / agent.c
index 27e7d029c9e452bccd5874239fcb68c7767f6364..988d2c4abad8dc4e29877c069616cfa3f6d63d33 100644 (file)
@@ -90,11 +90,18 @@ static int ht_match_event(struct cds_lfht_node *node,
        }
 
        /* Filter expression */
-       if (strncmp(event->filter_expression, key->filter_expression,
-                       strlen(event->filter_expression)) != 0) {
+       if (!!event->filter_expression ^ !!key->filter_expression) {
+               /* One has a filter expression, the other does not */
                goto no_match;
        }
 
+       if (event->filter_expression) {
+               if (strncmp(event->filter_expression, key->filter_expression,
+                               strlen(event->filter_expression)) != 0) {
+                       goto no_match;
+               }
+       }
+
        return 1;
 
 no_match:
This page took 0.037953 seconds and 4 git commands to generate.