[evolution-mapi] Bug #595480 - Crash on GAL retrieval



commit 056b10943e08f6cf32c7958ff587752f13856e88
Author: Milan Crha <mcrha redhat com>
Date:   Wed Sep 23 14:18:48 2009 +0200

    Bug #595480 - Crash on GAL retrieval

 src/libexchangemapi/exchange-mapi-connection.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index 66b6da2..a1b57f7 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -750,6 +750,8 @@ exchange_mapi_util_get_gal (GPtrArray *contacts_array)
 	
 	mem_ctx = talloc_init ("ExchangeMAPI_GetGAL");
 
+	LOCK ();
+
 	SPropTagArray = set_SPropTagArray(mem_ctx, 0xc,
 					  PR_INSTANCE_KEY,
 					  PR_ENTRYID,
@@ -770,7 +772,9 @@ exchange_mapi_util_get_gal (GPtrArray *contacts_array)
 		count += 0x2;
 		retval = GetGALTable(global_mapi_session, SPropTagArray, &SRowSet, count, ulFlags);
 		if ((!SRowSet) || (!(SRowSet->aRow))) {
-			return false;
+			UNLOCK ();
+			MAPIFreeBuffer (SPropTagArray);
+			return FALSE;
 		}
 		if (SRowSet->cRows) {
 			for (i = 0; i < SRowSet->cRows; i++) {
@@ -786,7 +790,9 @@ exchange_mapi_util_get_gal (GPtrArray *contacts_array)
 
 	MAPIFreeBuffer(SPropTagArray);
 
-	return true;
+	UNLOCK ();
+
+	return TRUE;
 	
 }
 
@@ -908,7 +914,9 @@ exchange_mapi_util_modify_recipients (TALLOC_CTX *mem_ctx, mapi_object_t *obj_me
 	}
 
 	/* Attempt to resolve names from the server */
+	LOCK ();
 	retval = ResolveNames (global_mapi_session, users, SPropTagArray, &SRowSet, &FlagList, 0);
+	UNLOCK ();
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("ResolveNames", GetLastError());
 		goto cleanup;



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