From b08b8d0c3a0fde9a7b35f7319832d34383afa172 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 23 Jul 2025 16:58:08 +0200 Subject: [PATCH] chore: miscellaneous fix in C code --- frankenphp.c | 5 +++++ frankenphp.h | 4 ++-- types.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frankenphp.c b/frankenphp.c index 9f1a085648..102af2db7f 100644 --- a/frankenphp.c +++ b/frankenphp.c @@ -775,6 +775,11 @@ static void frankenphp_register_variables(zval *track_vars_array) { /* In worker mode we cache the os environment */ if (os_environment == NULL) { os_environment = malloc(sizeof(zval)); + if (os_environment == NULL) { + php_error(E_ERROR, "Failed to allocate memory for os_environment"); + + return; + } array_init(os_environment); get_full_env(os_environment); // php_import_environment_variables(os_environment); diff --git a/frankenphp.h b/frankenphp.h index 3ca3075bca..246a221d65 100644 --- a/frankenphp.h +++ b/frankenphp.h @@ -1,5 +1,5 @@ -#ifndef _FRANKENPPHP_H -#define _FRANKENPPHP_H +#ifndef _FRANKENPHP_H +#define _FRANKENPHP_H #include #include diff --git a/types.c b/types.c index 3f8620566d..5ad0514e86 100644 --- a/types.c +++ b/types.c @@ -18,5 +18,5 @@ void *__emalloc__(size_t size) { return emalloc(size); } void __zend_hash_init__(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, bool persistent) { - zend_hash_init(ht, nSize, null, pDestructor, persistent); + zend_hash_init(ht, nSize, NULL, pDestructor, persistent); }