]> git.meshlink.io Git - meshlink/blobdiff - src/node.c
appname added, which is used by mdns as part of the service type
[meshlink] / src / node.c
index 7fc476f480aab645076dda3f856d3c0a2585fabb..edf2c85809134bc55581b7a9b5d46d562c2be663 100644 (file)
@@ -42,8 +42,12 @@ void init_nodes(meshlink_handle_t *mesh) {
 
 void exit_nodes(meshlink_handle_t *mesh) {
        pthread_mutex_lock(&(mesh->nodes_mutex));
-       hash_free(mesh->node_udp_cache);
-       splay_delete_tree(mesh->nodes);
+       if(mesh->node_udp_cache)
+               hash_free(mesh->node_udp_cache);
+       if(mesh->nodes)
+               splay_delete_tree(mesh->nodes);
+       mesh->node_udp_cache = NULL;
+       mesh->nodes = NULL;
        pthread_mutex_unlock(&(mesh->nodes_mutex));
 }
 
@@ -100,7 +104,7 @@ void node_del(meshlink_handle_t *mesh, node_t *n) {
        pthread_mutex_unlock(&(mesh->nodes_mutex));
 }
 
-node_t *lookup_node(meshlink_handle_t *mesh, char *name) {
+node_t *lookup_node(meshlink_handle_t *mesh, const char *name) {
        node_t n = {NULL};
        node_t* result;