Skip to content

Commit fc1de8f

Browse files
committed
fix(worker): comply with php-src coding style for memory allocation
1 parent cc08195 commit fc1de8f

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

frankenphp.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,7 @@ static void frankenphp_snapshot_session_handlers(void) {
298298
return; /* No user handlers to snapshot */
299299
}
300300

301-
worker_session_handlers_snapshot = malloc(sizeof(session_user_handlers));
302-
if (worker_session_handlers_snapshot == NULL) {
303-
return; /* Memory allocation failed */
304-
}
301+
worker_session_handlers_snapshot = emalloc(sizeof(session_user_handlers));
305302

306303
/* Copy each handler zval with incremented reference count */
307304
#define SNAPSHOT_HANDLER(handler) \
@@ -382,7 +379,7 @@ static void frankenphp_cleanup_worker_state(void) {
382379

383380
#undef FREE_HANDLER
384381

385-
free(worker_session_handlers_snapshot);
382+
efree(worker_session_handlers_snapshot);
386383
worker_session_handlers_snapshot = NULL;
387384
}
388385
}

0 commit comments

Comments
 (0)