/* Need exactly two arguments. */
g_critical("Invalid probe syntax '%s'.", tokens[i]);
ret = SR_ERR;
- break;
+ goto range_fail;
}
b = strtol(range[0], &eptr, 10);
if (eptr == range[0] || *eptr != '\0') {
g_critical("Invalid probe '%s'.", range[0]);
ret = SR_ERR;
- break;
+ goto range_fail;
}
e = strtol(range[1], NULL, 10);
if (eptr == range[1] || *eptr != '\0') {
g_critical("Invalid probe '%s'.", range[1]);
ret = SR_ERR;
- break;
+ goto range_fail;
}
if (b < 0 || b >= e) {
g_critical("Invalid probe range '%s'.", tokens[i]);
ret = SR_ERR;
- break;
+ goto range_fail;
}
while (b <= e) {
probelist = g_slist_append(probelist, probe);
b++;
}
+range_fail:
+ if (range)
+ g_strfreev(range);
+
if (ret != SR_OK)
break;
} else {
probe->name = g_strdup(names[1]);
}
probelist = g_slist_append(probelist, probe);
+
+ if (names)
+ g_strfreev(names);
}
}
- if (range)
- g_strfreev(range);
-
- if (names)
- g_strfreev(names);
if (ret != SR_OK) {
g_slist_free(probelist);