Check the return code of ipmi_main_intf->open(), and take the
error path if it fails. Right now we continue on blindly which
results in a SEGV.
---
 lib/ipmi_main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/ipmi_main.c b/lib/ipmi_main.c
index 54b80c0..81c64bf 100644
--- a/lib/ipmi_main.c
+++ b/lib/ipmi_main.c
@@ -894,8 +894,11 @@ ipmi_main(int argc, char ** argv,
 
        /* Open the interface with the specified or default IPMB address */
        ipmi_main_intf->my_addr = arg_addr ? arg_addr : IPMI_BMC_SLAVE_ADDR;
-       if (ipmi_main_intf->open != NULL)
-               ipmi_main_intf->open(ipmi_main_intf);
+
+       if (ipmi_main_intf->open != NULL) {
+               if (ipmi_main_intf->open(ipmi_main_intf) < 0)
+                        goto out_free;
+       }
 
        /*
         * Attempt picmg discovery of the actual interface address unless
-- 
1.8.3.2


------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to