Skip to content

Commit 8175ae7

Browse files
chore: miscellaneous fix in C code (#1766)
1 parent cd16da2 commit 8175ae7

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

frankenphp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,11 @@ static void frankenphp_register_variables(zval *track_vars_array) {
775775
/* In worker mode we cache the os environment */
776776
if (os_environment == NULL) {
777777
os_environment = malloc(sizeof(zval));
778+
if (os_environment == NULL) {
779+
php_error(E_ERROR, "Failed to allocate memory for os_environment");
780+
781+
return;
782+
}
778783
array_init(os_environment);
779784
get_full_env(os_environment);
780785
// php_import_environment_variables(os_environment);

frankenphp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _FRANKENPPHP_H
2-
#define _FRANKENPPHP_H
1+
#ifndef _FRANKENPHP_H
2+
#define _FRANKENPHP_H
33

44
#include <Zend/zend_modules.h>
55
#include <Zend/zend_types.h>

types.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ void *__emalloc__(size_t size) { return emalloc(size); }
1818

1919
void __zend_hash_init__(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor,
2020
bool persistent) {
21-
zend_hash_init(ht, nSize, null, pDestructor, persistent);
21+
zend_hash_init(ht, nSize, NULL, pDestructor, persistent);
2222
}

0 commit comments

Comments
 (0)