X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ecd5f7562caf1d443bf22788fa5f4fac408776ec..f968cbbb699423fa252994ff42de77f8671ac7eb:/src/xbt/mmalloc/mrealloc.c diff --git a/src/xbt/mmalloc/mrealloc.c b/src/xbt/mmalloc/mrealloc.c index aabf868be6..753eda8cd5 100644 --- a/src/xbt/mmalloc/mrealloc.c +++ b/src/xbt/mmalloc/mrealloc.c @@ -1,6 +1,6 @@ /* Change the size of a block allocated by `mmalloc'. */ -/* Copyright (c) 2010-2014. The SimGrid Team. +/* Copyright (c) 2010-2018. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -69,11 +69,9 @@ void *mrealloc(xbt_mheap_t mdp, void *ptr, size_t size) if (size <= BLOCKSIZE / 2) { // Full block -> Fragment; no need to optimize for time result = mmalloc(mdp, size); - if (result != NULL) { // useless (mmalloc never returns NULL), but harmless - memcpy(result, ptr, requested_size); - mfree(mdp, ptr); - return (result); - } + memcpy(result, ptr, requested_size); + mfree(mdp, ptr); + return (result); } /* Full blocks -> Full blocks; see if we can hold it in place. */