[Openswan dev] [PATCH] fix pluto segfault

Roel van Meer roel.vanmeer at bokxing.nl
Thu Oct 18 07:23:29 EDT 2012


Hi,

while debugging a crashing pluto daemon, I came across an incorrect free. 
Please see the attached patch, which fixes it.

Although I'm running this in production now, I haven't yet been able to 
assess if it fixes the crash, because it only occurs once every few months 
(but when it happens it happens several times a day). The patch is 
really straightforward though.

The crash was first reported on the openswan users list: 
https://lists.openswan.org/pipermail/users/2012-August/021873.html

Best regards,

Roel

-------------- next part --------------
Fix crash caused by incorrect pfree.

diff --git a/programs/pluto/kernel_pfkey.c b/programs/pluto/kernel_pfkey.c
index 82e6f09..da18942 100644
--- a/programs/pluto/kernel_pfkey.c
+++ b/programs/pluto/kernel_pfkey.c
@@ -1532,7 +1532,7 @@ scan_proc_shunts(void)
         struct eroute_info *p = orphaned_holds;
 
         orphaned_holds = p->next;
-        pfree(orphaned_holds);
+        pfree(p);
     }
 
     /* decode the /proc file.  Don't do anything strenuous to it


More information about the Dev mailing list