summaryrefslogtreecommitdiffstats
path: root/libmsi
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-11-30 11:29:29 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2012-12-06 20:30:31 +0100
commit1ece2a5f8a187d4493c96aff3a1ad64eeb497bcb (patch)
treeeaf1c7ec5cb0ba229e3b4a865254cb19fa7940a9 /libmsi
parent33399f41f9331ec2c1859af6634db3de72e946ba (diff)
downloadmsitools-1ece2a5f8a187d4493c96aff3a1ad64eeb497bcb.tar.gz
msitools-1ece2a5f8a187d4493c96aff3a1ad64eeb497bcb.tar.xz
msitools-1ece2a5f8a187d4493c96aff3a1ad64eeb497bcb.zip
test magic number
Diffstat (limited to 'libmsi')
-rw-r--r--libmsi/handle.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libmsi/handle.c b/libmsi/handle.c
index 251a4c8..b80ebdf 100644
--- a/libmsi/handle.c
+++ b/libmsi/handle.c
@@ -21,6 +21,7 @@
#define COBJMACROS
#include <stdarg.h>
+#include <assert.h>
#include "windef.h"
#include "winbase.h"
@@ -38,6 +39,7 @@ void *alloc_msiobject(unsigned size, msihandledestructor destroy )
info = msi_alloc_zero( size );
if( info )
{
+ info->magic = 0xC007C0DE;
info->refcount = 1;
info->destructor = destroy;
}
@@ -50,6 +52,7 @@ void msiobj_addref( LibmsiObject *info )
if( !info )
return;
+ assert(info->magic == 0xC007C0DE);
InterlockedIncrement(&info->refcount);
}
@@ -60,11 +63,13 @@ int msiobj_release( LibmsiObject *obj )
if( !obj )
return -1;
+ assert(obj->magic == 0xC007C0DE);
ret = InterlockedDecrement( &obj->refcount );
if( ret==0 )
{
if( obj->destructor )
obj->destructor( obj );
+ obj->magic = 0xDEADB0D7;
msi_free( obj );
TRACE("object %p destroyed\n", obj);
}