r18028 - gnucash/trunk/src/backend/sql - Fix crash when searching for a customer

Phil Longstaff plongstaff at code.gnucash.org
Mon Apr 6 19:44:14 EDT 2009


Author: plongstaff
Date: 2009-04-06 19:44:14 -0400 (Mon, 06 Apr 2009)
New Revision: 18028
Trac: http://svn.gnucash.org/trac/changeset/18028

Modified:
   gnucash/trunk/src/backend/sql/gnc-backend-sql.c
Log:
Fix crash when searching for a customer


Modified: gnucash/trunk/src/backend/sql/gnc-backend-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-backend-sql.c	2009-04-06 23:27:09 UTC (rev 18027)
+++ gnucash/trunk/src/backend/sql/gnc-backend-sql.c	2009-04-06 23:44:14 UTC (rev 18028)
@@ -700,12 +700,13 @@
 
     pQueryInfo = g_malloc( (gsize)sizeof( gnc_sql_query_info ) );
 	g_assert( pQueryInfo != NULL );
+	pQueryInfo->pCompiledQuery = NULL;
+    pQueryInfo->searchObj = searchObj;
 
     // Try various objects first
     be_data.is_ok = FALSE;
     be_data.be = be;
     be_data.pQuery = pQuery;
-    pQueryInfo->searchObj = searchObj;
     be_data.pQueryInfo = pQueryInfo;
 
     qof_object_foreach_backend( GNC_SQL_BACKEND, compile_query_cb, &be_data );
@@ -791,8 +792,10 @@
         return;
     }
 
-    DEBUG( "%s\n", (gchar*)pQueryInfo->pCompiledQuery );
-    g_free( pQueryInfo->pCompiledQuery );
+	if( pQueryInfo->pCompiledQuery != NULL ) {
+    	DEBUG( "%s\n", (gchar*)pQueryInfo->pCompiledQuery );
+    	g_free( pQueryInfo->pCompiledQuery );
+	}
     g_free( pQueryInfo );
 
 	LEAVE( "" );



More information about the gnucash-changes mailing list