diff options
Diffstat (limited to 'usr.sbin/smtpd/util.c')
-rw-r--r-- | usr.sbin/smtpd/util.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 3458a54599f..05b98c4a05d 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.77 2012/09/16 11:53:57 gilles Exp $ */ +/* $OpenBSD: util.c,v 1.78 2012/09/18 14:23:01 eric Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -88,6 +88,18 @@ xstrdup(const char *str, const char *where) return (r); } +void * +xmemdup(const void *ptr, size_t size, const char *where) +{ + void *r; + + if ((r = malloc(size)) == NULL) + errx(1, "%s: malloc(%zu)", where, size); + memmove(r, ptr, size); + + return (r); +} + int bsnprintf(char *str, size_t size, const char *format, ...) { |