Author: cazfi
Date: Tue Nov  8 18:37:21 2016
New Revision: 34444

URL: http://svn.gna.org/viewcvs/freeciv?rev=34444&view=rev
Log:
sanity_check_size() memory allocations on debug builds only.

See patch #7951

Modified:
    trunk/utility/mem.c

Modified: trunk/utility/mem.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/mem.c?rev=34444&r1=34443&r2=34444&view=diff
==============================================================================
--- trunk/utility/mem.c (original)
+++ trunk/utility/mem.c Tue Nov  8 18:37:21 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

Reply via email to