File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -65,10 +65,18 @@ static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */
65
65
close (ls -> sock );
66
66
} else { /* on PARENT EXEC we want socket fds to be inherited through environment variable */
67
67
char fd [32 ];
68
+ char * tmpenv_value ;
68
69
sprintf (fd , "%d" , ls -> sock );
69
70
70
71
socket_set_buf = (i % FPM_ENV_SOCKET_SET_SIZE == 0 && i ) ? 1 : 0 ;
71
- env_value = realloc (env_value , p + (p ? 1 : 0 ) + strlen (ls -> key ) + 1 + strlen (fd ) + socket_set_buf + 1 );
72
+ tmpenv_value = realloc (env_value , p + (p ? 1 : 0 ) + strlen (ls -> key ) + 1 + strlen (fd ) + socket_set_buf + 1 );
73
+ if (!tmpenv_value ) {
74
+ zlog (ZLOG_SYSERROR , "failure to inherit data on parent exec for socket `%s` due to memory allocation failure" , ls -> key );
75
+ free (ls -> key );
76
+ break ;
77
+ }
78
+
79
+ env_value = tmpenv_value ;
72
80
73
81
if (i % FPM_ENV_SOCKET_SET_SIZE == 0 ) {
74
82
socket_set [socket_set_count ] = p + socket_set_buf ;
You can’t perform that action at this time.
0 commit comments