Bypass 0 byte allocation when no domains are enabled
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index d882b074d54cd4f0348365ab4adb218ce263c48b..98e090539af0ecf7755abc2dfe1332b2f116f3fa 100644 (file)
@@ -2388,6 +2388,10 @@ ssize_t cmd_list_domains(struct ltt_session *session,
                }
        }
 
+       if (!nb_dom) {
+               goto end;
+       }
+
        *domains = zmalloc(nb_dom * sizeof(struct lttng_domain));
        if (*domains == NULL) {
                ret = LTTNG_ERR_FATAL;
@@ -2413,7 +2417,7 @@ ssize_t cmd_list_domains(struct ltt_session *session,
                        }
                }
        }
-
+end:
        return nb_dom;
 
 error:
This page took 0.026234 seconds and 5 git commands to generate.