From: Michael Wallner Date: Mon, 14 Sep 2020 12:43:59 +0000 (+0200) Subject: bin/memflush: fix exit code on connection failure X-Git-Tag: 1.1.0-beta1~236^2~71 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=60ae98b26965ead9238783c494c8b0d29f8e8d79;p=m6w6%2Flibmemcached bin/memflush: fix exit code on connection failure --- 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; }