handler: fix memory leak and use-after-free errors

The errors are related to newly added handler_system_delete_all().
This commit is contained in:
Dmitry Podgorny
2017-07-01 16:24:30 +03:00
parent cc53012cfa
commit c319ee6583
2 changed files with 3 additions and 1 deletions

View File

@@ -264,6 +264,8 @@ int xmpp_conn_release(xmpp_conn_t * const conn)
}
}
_conn_reset(conn);
/* free handler stuff
* note that userdata is the responsibility of the client
* and the handler pointers don't need to be freed since they
@@ -305,7 +307,6 @@ int xmpp_conn_release(xmpp_conn_t * const conn)
}
parser_free(conn->parser);
_conn_reset(conn);
if (conn->jid) xmpp_free(ctx, conn->jid);
if (conn->pass) xmpp_free(ctx, conn->pass);

View File

@@ -686,4 +686,5 @@ void handler_system_delete_all(xmpp_conn_t *conn)
xmpp_free(conn->ctx, key2);
}
}
if (iter) hash_iter_release(iter);
}