Author: cazfi Date: Tue Nov 8 18:37:30 2016 New Revision: 34445 URL: http://svn.gna.org/viewcvs/freeciv?rev=34445&view=rev Log: sanity_check_size() memory allocations on debug builds only.
See patch #7951 Modified: branches/S2_6/utility/mem.c Modified: branches/S2_6/utility/mem.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/mem.c?rev=34445&r1=34444&r2=34445&view=diff ============================================================================== --- branches/S2_6/utility/mem.c (original) +++ branches/S2_6/utility/mem.c Tue Nov 8 18:37:30 2016 @@ -43,6 +43,7 @@ exit(EXIT_FAILURE); } +#ifdef FREECIV_DEBUG /**************************************************************************** Check the size for sanity. The program will exit rather than allocate a dangerously large amount of memory. @@ -61,7 +62,7 @@ called_as, (unsigned long) size, line, file); } } - +#endif /* FREECIV_DEBUG */ /******************************************************************************* Function used by fc_malloc macro, malloc() replacement @@ -74,7 +75,9 @@ { void *ptr; +#ifdef FREECIV_DEBUG sanity_check_size(size, called_as, line, file); +#endif /* FREECIV_DEBUG */ /* Some systems return NULL on malloc(0) * According to ANSI C, the return is implementation-specific, @@ -104,7 +107,9 @@ return fc_real_malloc(size, called_as, line, file); } +#ifdef FREECIV_DEBUG sanity_check_size(size, called_as, line, file); +#endif /* FREECIV_DEBUG */ new_ptr = realloc(ptr, size); if (!new_ptr) { _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits