Index: debian-pdns/modules/gmysqlbackend/smysql.cc
===================================================================
--- debian-pdns.orig/modules/gmysqlbackend/smysql.cc	2011-03-08 15:57:20.000000000 +0100
+++ debian-pdns/modules/gmysqlbackend/smysql.cc	2011-03-08 15:57:45.000000000 +0100
@@ -20,7 +20,7 @@
 			  password.empty() ? 0 : password.c_str(),
 			  database.c_str(), port,
 			  msocket.empty() ? 0 : msocket.c_str(),
-			  0)) {
+			  CLIENT_MULTI_RESULTS)) {
 
     throw sPerrorException("Unable to connect to database");
   }
@@ -91,6 +91,13 @@
     return true;
   }
   mysql_free_result(d_rres);  
+
+  while (mysql_next_result(&d_db) == 0) {
+    if (d_rres = mysql_use_result(&d_db)) {
+      mysql_free_result(d_rres);
+    }
+  }
+
   d_rres=0;
   return false;
 }
