From 60ae98b26965ead9238783c494c8b0d29f8e8d79 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 14 Sep 2020 14:43:59 +0200 Subject: [PATCH] bin/memflush: fix exit code on connection failure --- src/bin/memflush.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bin/memflush.cc b/src/bin/memflush.cc index 8cd933ff..49d691b8 100644 --- a/src/bin/memflush.cc +++ b/src/bin/memflush.cc @@ -59,9 +59,12 @@ int main(int argc, char *argv[]) if (servers == NULL or memcached_server_list_count(servers) == 0) { std::cerr << "Invalid server list provided:" << opt_servers << std::endl; + free(opt_servers); return EXIT_FAILURE; } + free(opt_servers); + memcached_st *memc= memcached_create(NULL); memcached_server_push(memc, servers); memcached_server_list_free(servers); @@ -90,12 +93,11 @@ int main(int argc, char *argv[]) if (rc != MEMCACHED_SUCCESS) { std::cerr << memcached_last_error_message(memc) << std::endl; + memcached_free(memc); + return EXIT_FAILURE; } memcached_free(memc); - - free(opt_servers); - return EXIT_SUCCESS; } -- 2.30.2