diff --git a/src/zm_db.cpp b/src/zm_db.cpp index a342ca14b..bc15d9ec6 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -100,12 +100,13 @@ MYSQL_ROW zmDbFetchOne( const char *query ) { int n_rows = mysql_num_rows( result ); if ( n_rows != 1 ) { Error( "Bogus number of lines return from query, %d returned for query %s.", n_rows, query ); + mysql_free_result( result ); return NULL; } MYSQL_ROW dbrow = mysql_fetch_row( result ); - mysql_free_result( result ); if ( ! dbrow ) { + mysql_free_result( result ); Error("Error getting row from query %s. Error is %s", query, mysql_error( &dbconn ) ); return NULL; }