diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 230682e5d..66abae8a3 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -56,6 +56,7 @@ Bug fixes:: * irc: send whole IRC message including IRCv3 tags in the signals irc_in, irc_in2, irc_raw_in and irc_raw_in2 (issue #787) * irc: fix memory leak when receiving a message with IRCv3 tags * guile: fix memory leak in 7 functions returning allocated strings + * lua: fix macros used to return values * php: fix return code of functions config_write_option and config_write_line * php: fix memory leak in 72 functions returning allocated strings * python: fix crash when loading a script with Python >= 3.7 (issue #1219) diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index 1224042de..40eeab49c 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -70,38 +70,56 @@ #define API_STATIC_STRING(__string) \ plugin_script_get_static_string(&lua_data, __string); #define API_RETURN_OK \ - lua_pushinteger (L, 1); \ - return 1 + { \ + lua_pushinteger (L, 1); \ + return 1; \ + } #define API_RETURN_ERROR \ - lua_pushinteger (L, 0); \ - return 1 + { \ + lua_pushinteger (L, 0); \ + return 1; \ + } #define API_RETURN_EMPTY \ - lua_pushstring (L, ""); \ - return 0 + { \ + lua_pushstring (L, ""); \ + return 0; \ + } #define API_RETURN_STRING(__string) \ - lua_pushstring (L, \ - (__string) ? __string : ""); \ - return 1 + { \ + lua_pushstring (L, \ + (__string) ? __string : ""); \ + return 1; \ + } #define API_RETURN_STRING_FREE(__string) \ - lua_pushstring (L, \ - (__string) ? __string : ""); \ - if (__string) \ - free (__string); \ - return 1 + { \ + lua_pushstring (L, \ + (__string) ? __string : ""); \ + if (__string) \ + free (__string); \ + return 1; \ + } #if LUA_VERSION_NUM >= 503 #define API_RETURN_INT(__int) \ - lua_pushinteger (L, __int); \ - return 1 + { \ + lua_pushinteger (L, __int); \ + return 1; \ + } #define API_RETURN_LONG(__long) \ - lua_pushinteger (L, __long); \ - return 1 + { \ + lua_pushinteger (L, __long); \ + return 1; \ + } #else #define API_RETURN_INT(__int) \ - lua_pushnumber (L, __int); \ - return 1 + { \ + lua_pushnumber (L, __int); \ + return 1; \ + } #define API_RETURN_LONG(__long) \ - lua_pushnumber (L, __long); \ - return 1 + { \ + lua_pushnumber (L, __long); \ + return 1; \ + } #endif /* LUA_VERSION_NUM >= 503 */