Browse Source

use calloc_a

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau 11 years ago
parent
commit
38d78cba6e
2 changed files with 2 additions and 3 deletions
  1. 1 0
      procd.h
  2. 1 3
      service.c

+ 1 - 0
procd.h

@@ -2,6 +2,7 @@
 #define __PROCD_H
 
 #include <libubox/uloop.h>
+#include <libubox/utils.h>
 #include <libubus.h>
 #include <stdio.h>
 

+ 1 - 3
service.c

@@ -54,9 +54,7 @@ service_alloc(const char *name)
 	struct service *s;
 	char *new_name;
 
-	s = calloc(1, sizeof(*s) + strlen(name) + 1);
-
-	new_name = (char *) (s + 1);
+	s = calloc_a(sizeof(*s), &new_name, strlen(name) + 1);
 	strcpy(new_name, name);
 
 	vlist_init(&s->instances, avl_strcmp, service_instance_update);