The TrackerSparqlConnection is left open since is a class member and is closed in destructor.
TrackerSparqlCursor is unrefed.
Here i am about to execute a banch of queries.....but i am not interested in results....i am only interested if query has any results
bool TestClass::ExecuteBatchQuery(std::vector<std::string> &queries,std::vector<bool>* queryResponseCount){
   TrackerSparqlConnection *trackerConnection = getTrackerConnection(); // here we get the connection and we assign it to a class member...further calls to this will return the class member
   if (trackerConnection == NULL) {
       return false;
   }
   for (int i=0;i<queries.size();++i){
       GError* error = NULL;
       TrackerSparqlCursor* cursor = tracker_sparql_connection_query(trackerConnection,
queries.at(i).c_str(), NULL, &error);
       if (error) {
           queryResponseCount->push_back(false);
           g_error_free (error);
           continue;
       }
       if (cursor == NULL) {
           queryResponseCount->push_back(false);
           continue;
       } else {
           int cursorcount=0;
           while (tracker_sparql_cursor_next(cursor, NULL, &error)) {
               if (error)
                   break;
               cursorcount++;
               break;
           }
           if(cursorcount)
               queryResponseCount->push_back(true);
           else
               queryResponseCount->push_back(false);
          Â
       g_object_unref(cursor);
   }
   }
   return true;
}