Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
static int get_names_args(poptContext *pc)
{
char *str, *strlist, *strctx;
static int get_names_args(poptContext *pc)
{
char *str, *strlist, *strctx;
opt_payload_field_names = 0;
opt_context_field_names = 0;
opt_payload_field_names = 0;
opt_context_field_names = 0;
opt_payload_field_names = 0;
} else {
fprintf(stderr, "[error] unknown field name type %s\n", str);
opt_payload_field_names = 0;
} else {
fprintf(stderr, "[error] unknown field name type %s\n", str);
+ free(strlist);
+ ret = -EINVAL;
+ goto end;
}
} while ((str = strtok_r(NULL, ",", &strctx)));
}
} while ((str = strtok_r(NULL, ",", &strctx)));
+end:
+ free(strlist);
+ return ret;
}
static int get_fields_args(poptContext *pc)
{
char *str, *strlist, *strctx;
}
static int get_fields_args(poptContext *pc)
{
char *str, *strlist, *strctx;
strlist = (char *) poptGetOptArg(*pc);
if (!strlist) {
strlist = (char *) poptGetOptArg(*pc);
if (!strlist) {
opt_callsite_field = 1;
else {
fprintf(stderr, "[error] unknown field type %s\n", str);
opt_callsite_field = 1;
else {
fprintf(stderr, "[error] unknown field type %s\n", str);
+ ret = -EINVAL;
+ goto end;
}
} while ((str = strtok_r(NULL, ",", &strctx)));
}
} while ((str = strtok_r(NULL, ",", &strctx)));
+end:
+ free(strlist);
+ return ret;
break;
case OPT_CLOCK_OFFSET:
{
break;
case OPT_CLOCK_OFFSET:
{
- str = poptGetOptArg(pc);
+ str = (char *) poptGetOptArg(pc);
if (!str) {
fprintf(stderr, "[error] Missing --clock-offset argument\n");
ret = -EINVAL;
if (!str) {
fprintf(stderr, "[error] Missing --clock-offset argument\n");
ret = -EINVAL;
if (*endptr != '\0' || str == endptr || errno != 0) {
fprintf(stderr, "[error] Incorrect --clock-offset argument: %s\n", str);
ret = -EINVAL;
if (*endptr != '\0' || str == endptr || errno != 0) {
fprintf(stderr, "[error] Incorrect --clock-offset argument: %s\n", str);
ret = -EINVAL;
break;
}
case OPT_CLOCK_SECONDS:
break;
}
case OPT_CLOCK_SECONDS: