Skip to content

Commit

Permalink
use calloc_a
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  • Loading branch information
Felix Fietkau committed Dec 31, 2012
1 parent d343dd9 commit 38d78cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions procd.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define __PROCD_H

#include <libubox/uloop.h>
#include <libubox/utils.h>
#include <libubus.h>
#include <stdio.h>

Expand Down
4 changes: 1 addition & 3 deletions service.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 38d78cb

Please sign in to comment.