diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-10-02 16:44:53 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-10-02 17:29:58 +0200 |
commit | 74a73e2c41ed9661e32a26fe1460a1b8a68961e7 (patch) | |
tree | bf322717dcd60ef85d5ae1726ecbce01a17d6166 | |
parent | 76cd3c66f2f34e10749cabb7d489210c48d03342 (diff) |
lib: fix procedure entry in ut_require_utpl()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | lib.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -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 * |