=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/file/xmalloc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- src/usr.bin/file/xmalloc.c 2015/04/24 16:24:11 1.1 +++ src/usr.bin/file/xmalloc.c 2015/06/17 18:51:11 1.2 @@ -1,4 +1,4 @@ -/* $OpenBSD: xmalloc.c,v 1.1 2015/04/24 16:24:11 nicm Exp $ */ +/* $OpenBSD: xmalloc.c,v 1.2 2015/06/17 18:51:11 nicm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -65,24 +65,13 @@ return new_ptr; } -void -xfree(void *ptr) -{ - if (ptr == NULL) - errx(1, "xfree: NULL pointer given as argument"); - free(ptr); -} - char * xstrdup(const char *str) { - size_t len; char *cp; - len = strlen(str) + 1; - cp = xmalloc(len); - if (strlcpy(cp, str, len) >= len) - errx(1, "xstrdup: string truncated"); + if ((cp = strdup(str)) == NULL) + err(1, "xstrdup"); return cp; }