Skip to content

Commit

Permalink
fix: segfault caused by invalid free
Browse files Browse the repository at this point in the history
  • Loading branch information
Taanviir committed Jun 11, 2024
1 parent f8e14dc commit ac328e2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ clean:
$(RM) $(OBJS_DIR); \
echo "$(RED)$(BOLD)[ DELETE ]$(RESET) Removed object files."; \
fi
@if [ -f $(TEST_PARSER) ] || [ -f $(TEST_SOCKET) ] [ -f client ]; then \
@if [ -f $(TEST_PARSER) ] || [ -f $(TEST_SOCKET) ] || [ -f client ]; then \
$(RM) $(TEST_PARSER) $(TEST_SOCKET) client; \
echo "$(RED)$(BOLD)[ DELETE ]$(RESET) Removed testers."; \
fi
Expand Down
4 changes: 0 additions & 4 deletions sources/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ int main(int argc, char** argv)
LOG_INFO("Parsing " + configFile);

Server& webserv = Server::get_instance(servers, 100);
#if defined(__LINUX__)
webserv.start(SELECT);
#elif defined(__MAC__)
webserv.start(SELECT);
#endif
} catch (std::exception& error) {
LOG_ERROR(error.what());
}
Expand Down
4 changes: 2 additions & 2 deletions sources/server/Server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class Server {

~Server()
{
for (vector<ServerConfig>::iterator sc = cfgs.begin(); sc != cfgs.end(); sc++)
delete sc->cp;
for (servers_t::iterator s = servers.begin(); s != servers.end(); s++)
delete s->second.cp;
}

void start(enum polling_strat);
Expand Down

0 comments on commit ac328e2

Please sign in to comment.