MCPcopy Create free account
hub / github.com/Motion-Project/motion / mymalloc

Function mymalloc

src/util.c:195–207  ·  view source on GitHub ↗

* mymalloc * * Allocates some memory and checks if that succeeded or not. If it failed, * do some errorlogging and bail out. * * NOTE: Kenneth Lavrsen changed printing of size_t types so instead of using * conversion specifier %zd I changed it to %llu and casted the size_t * variable to unsigned long long. The reason for this nonsense is that older * versions of gcc like 2.95 u

Source from the content-addressed store, hash-verified

193 * Returns: a pointer to the allocated memory
194 */
195void *mymalloc(size_t nbytes)
196{
197 void *dummy = calloc(nbytes, 1);
198
199 if (!dummy) {
200 MOTION_LOG(EMG, TYPE_ALL, SHOW_ERRNO, _("Could not allocate %llu bytes of memory!")
201 ,(unsigned long long)nbytes);
202 motion_remove_pid();
203 exit(1);
204 }
205
206 return dummy;
207}
208
209/**
210 * myrealloc

Callers 15

event_stream_putFunction · 0.85
event_ffmpeg_newfileFunction · 0.85
event_ffmpeg_timelapseFunction · 0.85
ffmpeg_encode_videoFunction · 0.85
webu_context_initFunction · 0.85
webu_writeFunction · 0.85
webu_failauth_logFunction · 0.85
webu_mhd_auth_parseFunction · 0.85
webu_mhd_loadfileFunction · 0.85
webu_start_failauthFunction · 0.85
webu_startFunction · 0.85
rotate_initFunction · 0.85

Calls 1

motion_remove_pidFunction · 0.85

Tested by

no test coverage detected