aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-echo.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-07-28 05:21:55 +0200
committerMattias Andrée <maandree@operamail.com>2014-07-28 05:21:55 +0200
commit368178c777870459b6e1a0275b94f178bbbafb2d (patch)
tree2a8d77f7469e9ceae20d4a1ae6461932815c2512 /src/mds-echo.c
parentmds-registry: sync:ing and list action (diff)
downloadmds-368178c777870459b6e1a0275b94f178bbbafb2d.tar.gz
mds-368178c777870459b6e1a0275b94f178bbbafb2d.tar.bz2
mds-368178c777870459b6e1a0275b94f178bbbafb2d.tar.xz
misc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
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;
}