From 220b0ec649491ca1905ba0dfd854102be8e13f46 Mon Sep 17 00:00:00 2001 From: Norihiro Kamae Date: Tue, 1 Apr 2025 13:45:29 +0900 Subject: [PATCH] libobs/callback: Catch fail cases with missing error data In `parse_decl_string`, it jumps to `fail` label if an error occurs. However, if the lexer encountered an error for example, `cfp.error_list` may be empty. --- libobs/callback/decl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libobs/callback/decl.c b/libobs/callback/decl.c index 24a0eb846..c786ad589 100644 --- a/libobs/callback/decl.c +++ b/libobs/callback/decl.c @@ -182,7 +182,7 @@ bool parse_decl_string(struct decl_info *decl, const char *decl_string) struct strref ret_type; struct decl_param ret_param = {0}; int code; - bool success; + bool success = false; decl->decl_string = decl_string; ret_param.flags = CALL_PARAM_OUT; @@ -210,9 +210,11 @@ bool parse_decl_string(struct decl_info *decl, const char *decl_string) goto fail; parse_params(&cfp, decl); + success = true; fail: - success = !error_data_has_errors(&cfp.error_list); + if (error_data_has_errors(&cfp.error_list)) + success = false; if (success && ret_param.type != CALL_PARAM_TYPE_VOID) { ret_param.name = bstrdup("return");