]> git.e2factory.org Git - e2factory.git/commitdiff
Fix use after free in poll
authorTobias Ulmer <tu@emlix.com>
Wed, 15 Jan 2014 19:16:52 +0000 (20:16 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:17 +0000 (15:41 +0100)
Been there since the beginning of (e2factory) time.

Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/le2lib.c

index 2105173e8ee0cfb632258294562c490088f7b9f5..981f054afee9cdcbdcd291f993d364b368536354 100644 (file)
@@ -338,10 +338,10 @@ poll_fd(lua_State *lua)
        if (f > 0) {
                while (--nfds >= 0) {
                        if (fds[nfds].revents) {
-                               free(fds);
                                lua_pushnumber(lua, nfds+1);
                                lua_pushboolean(lua, fds[nfds].revents & POLLIN);
                                lua_pushboolean(lua, fds[nfds].revents & POLLOUT);
+                               free(fds);
                                return 3;
                        }
                }