=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/xmalloc.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/cvs/xmalloc.c 2009/06/07 08:39:13 1.9 --- src/usr.bin/cvs/xmalloc.c 2014/12/01 21:58:46 1.10 *************** *** 1,4 **** ! /* $OpenBSD: xmalloc.c,v 1.9 2009/06/07 08:39:13 ray Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland --- 1,4 ---- ! /* $OpenBSD: xmalloc.c,v 1.10 2014/12/01 21:58:46 deraadt Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland *************** *** 51,57 **** } void * ! xrealloc(void *ptr, size_t nmemb, size_t size) { void *new_ptr; size_t new_size = nmemb * size; --- 51,57 ---- } void * ! xreallocarray(void *ptr, size_t nmemb, size_t size) { void *new_ptr; size_t new_size = nmemb * size; *************** *** 60,69 **** fatal("xrealloc: zero size"); if (SIZE_MAX / nmemb < size) fatal("xrealloc: nmemb * size > SIZE_MAX"); ! if (ptr == NULL) ! new_ptr = malloc(new_size); ! else ! new_ptr = realloc(ptr, new_size); if (new_ptr == NULL) fatal("xrealloc: out of memory (new_size %lu bytes)", (u_long) new_size); --- 60,66 ---- fatal("xrealloc: zero size"); if (SIZE_MAX / nmemb < size) fatal("xrealloc: nmemb * size > SIZE_MAX"); ! new_ptr = realloc(ptr, new_size); if (new_ptr == NULL) fatal("xrealloc: out of memory (new_size %lu bytes)", (u_long) new_size);