Browse Source

avoid crash when OOM on mem_realloc

git-svn-id: svn://svn.lighttpd.net/xcache/branches/1.0@150 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.0
Xuefer 15 years ago
parent
commit
f214711067
  1. 2
      mem.c

2
mem.c

@ -250,7 +250,7 @@ void *xc_mem_calloc(xc_mem_t *mem, xc_memsize_t memb, xc_memsize_t size) /* {{{
void *xc_mem_realloc(xc_mem_t *mem, const void *p, xc_memsize_t size) /* {{{ */
{
void *newp = xc_mem_malloc(mem, size);
if (p) {
if (p && newp) {
memcpy(newp, p, size);
xc_mem_free(mem, p);
}

Loading…
Cancel
Save