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>
(Imported from commit
a689cd5d955214fe94f19af9d1b5aec6d44d568a)
static int control_ipiface(struct ctdb_context *ctdb, int argc, const char **argv)
{
ctdb_sock_addr addr;
+ char *iface = NULL;
if (argc != 1) {
usage();
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;
}