[prev in list] [next in list] [prev in thread] [next in thread] 

List:       prelude-cvslog
Subject:    [prelude-cvslog] r9871 - libprelude/trunk/src
From:       noreply () prelude-ids ! org
Date:       2007-08-31 7:16:07
Message-ID: 20070831071607.B70E8A977B8 () mail ! prelude-ids ! org
[Download RAW message or body]

Author: yoann
Date: 2007-08-31 09:15:59 +0200 (Fri, 31 Aug 2007)
New Revision: 9871

Modified:
   libprelude/trunk/src/prelude-plugin.c
Log:
Prevent possible NULL pointer dereference on destroy() error.


Modified: libprelude/trunk/src/prelude-plugin.c
===================================================================
--- libprelude/trunk/src/prelude-plugin.c	2007-08-30 15:26:18 UTC (rev 9870)
+++ libprelude/trunk/src/prelude-plugin.c	2007-08-31 07:15:59 UTC (rev 9871)
@@ -237,8 +237,26 @@
         }
 
         if ( pi->entry->plugin->destroy ) {
+                int ret;
+                prelude_bool_t need_free = FALSE;
+
+                if ( ! out ) {
+                        ret = prelude_string_new(&out);
+                        if ( ret < 0 )
+                                return ret;
+
+                        need_free = TRUE;
+                }
+
                 pi->entry->plugin->destroy(pi, out);
-                pi->entry->plugin->destroy = NULL; /* prevent unsubscribe from destroying it again */
+                if ( need_free )
+                        prelude_string_destroy(out);
+
+
+                /*
+                 * prevent unsubscribe from destroying it again
+                 */
+                pi->entry->plugin->destroy = NULL;
         }
 
         return prelude_plugin_instance_unsubscribe(pi);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic