aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-echo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mds-echo.c')
-rw-r--r--src/mds-echo.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mds-echo.c b/src/mds-echo.c
index 0f05e25..4295816 100644
--- a/src/mds-echo.c
+++ b/src/mds-echo.c
@@ -159,6 +159,8 @@ int marshal_server(char* state_buf)
buf_set_next(state_buf, int, connected);
buf_set_next(state_buf, int32_t, message_id);
mds_message_marshal(&received, state_buf);
+
+ mds_message_destroy(&received);
return 0;
}
@@ -206,6 +208,8 @@ int __attribute__((const)) reexec_failure_recover(void)
*/
int master_loop(void)
{
+ int rc = 1;
+
while (!reexecing && !terminating)
{
int r = mds_message_read(&received, socket_fd);
@@ -235,15 +239,15 @@ int master_loop(void)
connected = 1;
}
- mds_message_destroy(&received);
- free(echo_buffer);
- return 0;
+ rc = 0;
+ goto fail;
pfail:
perror(*argv);
fail:
- mds_message_destroy(&received);
+ if (rc || !reexecing)
+ mds_message_destroy(&received);
free(echo_buffer);
- return 1;
+ return rc;
}