lua: fix ubus_lua_format_blob_is_array() to not leave garbage on the stack
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 16 Oct 2012 16:37:31 +0000 (19:37 +0300)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 16 Oct 2012 16:37:31 +0000 (19:37 +0300)
lua/ubus.c

index 081ff45b53f6482657d5922a8bc130f4b294198f..bdf924a03e1b4891d500cced6a1c6b412f2d05aa 100644 (file)
@@ -137,7 +137,7 @@ ubus_lua_format_blob_is_array(lua_State *L)
                if (lua_type(L, -2) != LUA_TNUMBER)
 #endif
                {
-                       lua_pop(L, 1);
+                       lua_pop(L, 2);
                        return false;
                }
 
@@ -145,13 +145,14 @@ ubus_lua_format_blob_is_array(lua_State *L)
 
                if ((cur - 1) != prv)
                {
-                       lua_pop(L, 1);
+                       lua_pop(L, 2);
                        return false;
                }
 
                prv = cur;
        }
 
+       lua_pop(L, 1);
        return true;
 }