From: Niklas Hofmann Date: Tue, 12 Aug 2014 14:40:41 +0000 (+0200) Subject: fixed some potentially nasty memory issues X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=1bcadbde8302683f9803129f847ded42a4f66d27;p=meshlink fixed some potentially nasty memory issues --- diff --git a/src/meshlink++.h b/src/meshlink++.h index 5f5539a2..ef578b11 100644 --- a/src/meshlink++.h +++ b/src/meshlink++.h @@ -88,7 +88,7 @@ namespace meshlink { /// A class describing a MeshLink mesh. class mesh: public meshlink_handle_t { public: - mesh() {} + mesh() : meshlink_handle_t() {} virtual ~mesh() { meshlink_close(this); diff --git a/src/meshlink.h b/src/meshlink.h index 9f6c63ce..e9c531ff 100644 --- a/src/meshlink.h +++ b/src/meshlink.h @@ -85,14 +85,14 @@ extern __thread meshlink_errno_t meshlink_errno; #ifndef MESHLINK_INTERNAL_H struct meshlink_handle { - const char *name; + char *name; char *appname; dev_class_t devclass; void *priv; }; struct meshlink_node { - const char *name; ///< Textual name of this node. It is stored in a nul-terminated C string, which is allocated by MeshLink. + char *name; ///< Textual name of this node. It is stored in a nul-terminated C string, which is allocated by MeshLink. void *priv; ///< Private pointer which may be set freely by the application, and is never used or modified by MeshLink. }; diff --git a/src/net.c b/src/net.c index 6528fab9..9659a8f2 100644 --- a/src/net.c +++ b/src/net.c @@ -364,7 +364,7 @@ static void periodic_handler(event_loop_t *loop, void *data) { { logger(mesh, MESHLINK_INFO, "* found best one for initial connect"); - timeout = 0; + //timeout = 0; connect_to = (node_t*)nodes->head->data; } @@ -501,7 +501,7 @@ static void periodic_handler(event_loop_t *loop, void *data) { { logger(mesh, MESHLINK_INFO, "* disconnect connection (too many connections"); - timeout = 0; + //timeout = 0; disconnect_from = (node_t*)nodes->head->data; } diff --git a/src/node.h b/src/node.h index 23237522..409449c9 100644 --- a/src/node.h +++ b/src/node.h @@ -40,6 +40,8 @@ typedef struct node_status_t { typedef struct node_t { char *name; /* name of this node */ + void *priv; + uint32_t options; /* options turned on for this node */ dev_class_t devclass;