summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-10-02 16:44:53 +0200
committerJo-Philipp Wich <jo@mein.io>2020-10-02 17:29:58 +0200
commit74a73e2c41ed9661e32a26fe1460a1b8a68961e7 (patch)
treebf322717dcd60ef85d5ae1726ecbce01a17d6166
parent76cd3c66f2f34e10749cabb7d489210c48d03342 (diff)
lib: fix procedure entry in ut_require_utpl()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--lib.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib.c b/lib.c
index 4ad0ec8..a5e6001 100644
--- a/lib.c
+++ b/lib.c
@@ -1574,7 +1574,7 @@ ut_require_so(struct ut_state *s, uint32_t off, const char *path)
static struct json_object *
ut_require_utpl(struct ut_state *s, uint32_t off, const char *path)
{
- struct json_object *ex, *scope;
+ struct json_object *ex, *scope, *entry, *rv;
char *source, *msg;
struct stat st;
FILE *sfile;
@@ -1615,7 +1615,20 @@ ut_require_utpl(struct ut_state *s, uint32_t off, const char *path)
if (!scope)
return ut_exception(s, off, UT_ERRMSG_OOM);
- return ut_invoke(s, off, scope, ut_get_op(s, s->main)->val, NULL);
+ entry = ut_new_func(ut_get_op(s, s->main));
+
+ if (!entry) {
+ json_object_put(scope);
+
+ return ut_exception(s, off, UT_ERRMSG_OOM);
+ }
+
+ rv = ut_invoke(s, off, scope, entry, NULL);
+
+ json_object_put(entry);
+ json_object_put(scope);
+
+ return rv;
}
static struct json_object *