File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
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 ;
Original file line number Diff line number Diff line change @@ -348,7 +348,7 @@ static ssize_t zlog_stream_direct_write(
348
348
static inline ssize_t zlog_stream_unbuffered_write (
349
349
struct zlog_stream * stream , const char * buf , size_t len ) /* {{{ */
350
350
{
351
- const char * append ;
351
+ const char * append = NULL ;
352
352
size_t append_len = 0 , required_len , reserved_len ;
353
353
ssize_t written ;
354
354
You can’t perform that action at this time.
0 commit comments