Fixed null-pointer dereference in smp plugin.
authorTobias Brunner <tobias@strongswan.org>
Thu, 26 Apr 2012 06:50:39 +0000 (08:50 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 26 Apr 2012 06:54:04 +0000 (08:54 +0200)
src/libcharon/plugins/smp/smp.c

index 1873d96..2b83001 100644 (file)
@@ -461,17 +461,21 @@ static void request_control_initiate(xmlTextReaderPtr reader,
 
                /* <log> */
                xmlTextWriterStartElement(writer, "log");
-               peer = charon->backends->get_peer_cfg_by_name(charon->backends, (char*)str);
+               peer = charon->backends->get_peer_cfg_by_name(charon->backends,
+                                                                                                         (char*)str);
                if (peer)
                {
                        enumerator = peer->create_child_cfg_enumerator(peer);
                        if (ike)
                        {
-                               if (!enumerator->enumerate(enumerator, &child))
+                               if (enumerator->enumerate(enumerator, &child))
+                               {
+                                       child->get_ref(child);
+                               }
+                               else
                                {
                                        child = NULL;
                                }
-                               child->get_ref(child);
                        }
                        else
                        {