summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorRajesh Joseph <rjoseph@redhat.com>2015-04-16 12:25:28 +0530
committerGünther Deschner <gd@samba.org>2015-04-17 14:12:19 +0200
commita689cd5d955214fe94f19af9d1b5aec6d44d568a (patch)
treef8805dd74bf53c5cebb177ffae7c9246508dab49 /ctdb
parent450b7c619f89c596b6391a3f353364fa0943e500 (diff)
downloadsamba-a689cd5d955214fe94f19af9d1b5aec6d44d568a.tar.gz
ctdb: Coverity fix for CID 1125625
Memory allocated by ctdb_sys_find_ifname is not freed by the caller. Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tools/ctdb.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index e7f166dbb45..66d03836552 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -2418,6 +2418,7 @@ static int control_addip(struct ctdb_context *ctdb, int argc, const char **argv)
static int control_ipiface(struct ctdb_context *ctdb, int argc, const char **argv)
{
ctdb_sock_addr addr;
+ char *iface = NULL;
if (argc != 1) {
usage();
@@ -2428,7 +2429,15 @@ static int control_ipiface(struct ctdb_context *ctdb, int argc, const char **arg
return -1;
}
- printf("IP on interface %s\n", ctdb_sys_find_ifname(&addr));
+ iface = ctdb_sys_find_ifname(&addr);
+ if (iface == NULL) {
+ printf("Failed to get interface name for ip: %s", argv[0]);
+ return -1;
+ }
+
+ printf("IP on interface %s\n", iface);
+
+ free(iface);
return 0;
}