diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-12-01 12:21:52 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-12-01 12:21:52 +0100 |
commit | 096a497b36f208fb68a12c7ae7576ca0a69f919d (patch) | |
tree | 3845c9631fab6a3a6177813367ddd03f7867700b /src/plugins/ipmi_intf.c | |
parent | 7b5768ae6a3fee6cb80300824b9e758021b22f2e (diff) | |
parent | 55031e72e6c02b4ae63e9052bad1a4b40002ac18 (diff) |
Import new upstream release 1.8.15
Diffstat (limited to 'src/plugins/ipmi_intf.c')
-rw-r--r-- | src/plugins/ipmi_intf.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/plugins/ipmi_intf.c b/src/plugins/ipmi_intf.c index 0fa76be..a84237e 100644 --- a/src/plugins/ipmi_intf.c +++ b/src/plugins/ipmi_intf.c @@ -194,15 +194,14 @@ struct ipmi_intf * ipmi_intf_load(char * name) void ipmi_intf_session_set_hostname(struct ipmi_intf * intf, char * hostname) { - if (intf->session == NULL) + if (intf->session == NULL || hostname == NULL) { return; - - memset(intf->session->hostname, 0, 16); - - if (hostname != NULL) { - memcpy(intf->session->hostname, hostname, - __min(strlen(hostname), 64)); } + if (intf->session->hostname != NULL) { + free(intf->session->hostname); + intf->session->hostname = NULL; + } + intf->session->hostname = strdup(hostname); } void @@ -331,6 +330,20 @@ ipmi_intf_session_set_retry(struct ipmi_intf * intf, int retry) } void +ipmi_intf_session_cleanup(struct ipmi_intf *intf) +{ + if (intf->session == NULL) { + return; + } + if (intf->session->hostname != NULL) { + free(intf->session->hostname); + intf->session->hostname = NULL; + } + free(intf->session); + intf->session = NULL; +} + +void ipmi_cleanup(struct ipmi_intf * intf) { ipmi_sdr_list_empty(intf); |