File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 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) /* {{{ */
6565 close (ls -> sock );
6666 } else { /* on PARENT EXEC we want socket fds to be inherited through environment variable */
6767 char fd [32 ];
68+ char * tmpenv_value ;
6869 sprintf (fd , "%d" , ls -> sock );
6970
7071 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 ;
7280
7381 if (i % FPM_ENV_SOCKET_SET_SIZE == 0 ) {
7482 socket_set [socket_set_count ] = p + socket_set_buf ;
You can’t perform that action at this time.
0 commit comments