Fix #1566 - proper error cleanup in mg_listen

This commit is contained in:
Sergey Lyubka committed 2022-05-30 17:56:50 +01:00
1 parent 65957527cb
commit b8bba7513a
3 files changed
+20 -6

No files matched your search

+1
View File
@@ -194,6 +194,7 @@ struct mg_connection *mg_listen(struct mg_mgr *mgr, const char *url,
} else if (!mg_open_listener(c, url)) {
MG_ERROR(("Failed: %s, errno %d", url, errno));
free(c);
c = NULL;
} else {
c->is_listening = 1;
c->is_udp = strncmp(url, "udp:", 4) == 0;