diff options
Diffstat (limited to 'avahi-common/malloc.c')
-rw-r--r-- | avahi-common/malloc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/avahi-common/malloc.c b/avahi-common/malloc.c index 19e1e59..1883849 100644 --- a/avahi-common/malloc.c +++ b/avahi-common/malloc.c @@ -161,6 +161,8 @@ char *avahi_strdup_vprintf(const char *fmt, va_list ap) { char *avahi_strdup_printf(const char *fmt, ... ) { char *s; va_list ap; + + assert(fmt); va_start(ap, fmt); s = avahi_strdup_vprintf(fmt, ap); @@ -169,3 +171,13 @@ char *avahi_strdup_printf(const char *fmt, ... ) { return s; } +void *avahi_memdup(const void *s, size_t l) { + void *p; + assert(s); + + if (!(p = avahi_malloc(l))) + return NULL; + + memcpy(p, s, l); + return p; +} |