From 756dd57534137b41398c5dcfe1d013267ba53136 Mon Sep 17 00:00:00 2001 From: Stephen Baynham Date: Fri, 10 Apr 2020 17:00:02 -0700 Subject: [PATCH] Correctly initialize some objects --- go_callbacks.c | 4 ++++ go_luatypes.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/go_callbacks.c b/go_callbacks.c index 90c1740..7cbecbe 100644 --- a/go_callbacks.c +++ b/go_callbacks.c @@ -28,7 +28,11 @@ int execute_go_callback(lua_State *_L) { lua_return *goReturn = chmalloc(sizeof(lua_return)); goReturn->valueCount = 0; + goReturn->values = NULL; + lua_err *retErr = chmalloc(sizeof(lua_error)); + retErr->message = NULL; + goReturn->err = retErr; callbackGoFunction(_L, *goCallback, args, goReturn); free_temporary_lua_args(_L, args, 1); diff --git a/go_luatypes.c b/go_luatypes.c index b7c478f..cd03b12 100644 --- a/go_luatypes.c +++ b/go_luatypes.c @@ -398,6 +398,8 @@ lua_err *push_lua_return(lua_State *_L, lua_return retVal) { lua_unrolled_table *build_unrolled_table(int entries) { lua_unrolled_table *table = chmalloc(sizeof(lua_unrolled_table)); + table->first = NULL; + table->last = NULL; lua_table_entry *entry = NULL; for (int i = 0; i < entries; i++) {