[evolution-data-server] CamelIMAPXCommand: Fill memory with a bit pattern before freeing.



commit fcae79783cff03a663e0efc8b2174a58d4945467
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Mar 23 11:11:47 2012 -0400

    CamelIMAPXCommand: Fill memory with a bit pattern before freeing.
    
    To help track down finalized CamelIMAPXCommands being passed around.

 camel/providers/imapx/camel-imapx-command.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-command.c b/camel/providers/imapx/camel-imapx-command.c
index 0c3204f..29ea2fb 100644
--- a/camel/providers/imapx/camel-imapx-command.c
+++ b/camel/providers/imapx/camel-imapx-command.c
@@ -142,6 +142,15 @@ camel_imapx_command_unref (CamelIMAPXCommand *ic)
 		 * propagated to the CamelIMAPXJob, so it's either NULL or the
 		 * CamelIMAPXJob owns it now. */
 
+		/* Fill the memory with a bit pattern before releasing
+		 * it back to the slab allocator, so we can more easily
+		 * identify dangling CamelIMAPXCommand pointers. */
+		memset (real_ic, 0xaa, sizeof (CamelIMAPXRealCommand));
+
+		/* But leave the reference count set to zero, so
+		 * CAMEL_IS_IMAPX_COMMAND can identify it as bad. */
+		real_ic->ref_count = 0;
+
 		g_slice_free (CamelIMAPXRealCommand, real_ic);
 	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]