summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2025-03-05 07:13:23 +0000
committerFelix Fietkau2025-03-05 07:25:43 +0000
commit12298ca7c497d497564ee22851e6fc2342f0f26e (patch)
tree64c3b635e57b1def342aa250ddd328bc13931094
parentd65d546bce36ec71e3cda4e631f24cc711f7bcb2 (diff)
downloadopenwrt-12298ca7c497d497564ee22851e6fc2342f0f26e.tar.gz
ucode-mod-uline: fix refcounting errors
Do not call ucv_get if the reference is transferred without being used elsewhere Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--package/utils/ucode-mod-uline/src/ucode.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/package/utils/ucode-mod-uline/src/ucode.c b/package/utils/ucode-mod-uline/src/ucode.c
index 7f1d9b1e34..4f1a3b627c 100644
--- a/package/utils/ucode-mod-uline/src/ucode.c
+++ b/package/utils/ucode-mod-uline/src/ucode.c
@@ -153,8 +153,7 @@ uc_uline_get_line(uc_vm_t *vm, size_t nargs)
uline_get_line2(&us->s, &line, &len);
else
uline_get_line(&us->s, &line, &len);
- val = ucv_string_new_length(line, len);
- ucv_object_add(state, "line", ucv_get(val));
+ ucv_object_add(state, "line", ucv_string_new_length(line, len));
ucv_object_add(state, "pos", ucv_int64_new(us->s.line.pos));
return state;
@@ -589,7 +588,7 @@ uc_uline_add_pos(uc_vm_t *vm, uc_value_t *list, ssize_t start, ssize_t end)
uc_value_t *val = ucv_array_new(vm);
ucv_array_push(val, ucv_int64_new(start));
ucv_array_push(val, ucv_int64_new(end));
- ucv_array_push(list, ucv_get(val));
+ ucv_array_push(list, val);
}
static uc_value_t *
@@ -630,8 +629,8 @@ uc_uline_parse_args(uc_vm_t *vm, size_t nargs, bool check)
if (argp->line_sep) {
args = ucv_array_new(vm);
pos_args = ucv_array_new(vm);
- ucv_array_push(args, ucv_get(list));
- ucv_array_push(pos_args, ucv_get(pos_list));
+ ucv_array_push(args, list);
+ ucv_array_push(pos_args, pos_list);
} else {
args = list;
pos_args = pos_list;
@@ -692,10 +691,10 @@ uc_uline_parse_args(uc_vm_t *vm, size_t nargs, bool check)
buf = NULL;
list = ucv_array_new(vm);
- ucv_array_push(args, ucv_get(list));
+ ucv_array_push(args, list);
pos_list = ucv_array_new(vm);
- ucv_array_push(pos_args, ucv_get(pos_list));
+ ucv_array_push(pos_args, pos_list);
}
}
continue;
@@ -751,7 +750,7 @@ uc_uline_parse_args(uc_vm_t *vm, size_t nargs, bool check)
}
if (buf) {
- ucv_array_push(list, ucv_get(ucv_stringbuf_finish(buf)));
+ ucv_array_push(list, ucv_stringbuf_finish(buf));
uc_uline_add_pos(vm, pos_list, start_idx, end_idx);
}
@@ -762,10 +761,10 @@ uc_uline_parse_args(uc_vm_t *vm, size_t nargs, bool check)
return missing;
ret = ucv_object_new(vm);
- ucv_object_add(ret, "args", ucv_get(args));
- ucv_object_add(ret, "pos", ucv_get(pos_args));
+ ucv_object_add(ret, "args", args);
+ ucv_object_add(ret, "pos", pos_args);
if (missing)
- ucv_object_add(ret, "missing", ucv_get(missing));
+ ucv_object_add(ret, "missing", missing);
return ret;
}