This prevents potentially bad behaviour when the application calls
meshlink_close() twice on the same pointer.
exit_configuration(&mesh->config);
event_loop_exit(&mesh->loop);
- free(mesh);
-
#ifdef HAVE_MINGW
- WSACleanup();
+ if(mesh->confbase)
+ WSACleanup();
#endif
+
+ ecdsa_free(mesh->invitation_key);
+
+ free(mesh->name);
+ free(mesh->confbase);
+
+ free(mesh);
+
+ memset(mesh, 0, sizeof *mesh);
}
void meshlink_set_receive_cb(meshlink_handle_t *mesh, meshlink_receive_cb_t cb) {