| 2136 | /* Safe version of malloc(). This function is taken from gdal/cpl. */ |
| 2137 | |
| 2138 | void *msSmallMalloc( size_t nSize ) |
| 2139 | { |
| 2140 | void *pReturn; |
| 2141 | |
| 2142 | if( nSize == 0 ) |
| 2143 | return NULL; |
| 2144 | |
| 2145 | if( nSize < 0 ) |
| 2146 | { |
| 2147 | fprintf(stderr, "msSmallMalloc(%ld): Silly size requested.\n", |
| 2148 | (long) nSize ); |
| 2149 | return NULL; |
| 2150 | } |
| 2151 | |
| 2152 | pReturn = malloc( nSize ); |
| 2153 | if( pReturn == NULL ) |
| 2154 | { |
| 2155 | fprintf(stderr, "msSmallMalloc(): Out of memory allocating %ld bytes.\n", |
| 2156 | (long) nSize ); |
| 2157 | exit(1); |
| 2158 | } |
| 2159 | |
| 2160 | return pReturn; |
| 2161 | } |
| 2162 | |
| 2163 | /************************************************************************/ |
| 2164 | /* msSmallRealloc() */ |
no outgoing calls
no test coverage detected