lq_plugin: do not confuse malloc size with name size
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 2 Jun 2016 19:01:48 +0000 (21:01 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 2 Jun 2016 20:06:48 +0000 (22:06 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/lq_plugin.c

index 17d4c7f..a917c84 100644 (file)
@@ -139,9 +139,9 @@ void
 register_lq_handler(struct lq_handler *handler, const char *name)
 {
   struct lq_handler_node *node;
-  size_t name_size = sizeof(*node) + strlen(name) + 1;
+  size_t name_size = strlen(name) + 1;
 
-  node = olsr_malloc(name_size, "olsr lq handler");
+  node = olsr_malloc(sizeof(*node) + name_size, "olsr lq handler");
 
   strscpy(node->name, name, name_size);
   node->node.key = node->name;