Merge tag 'release_3_0_12' into branch moonshot-fr-3.0.12-upgrade.
[freeradius.git] / src / modules / rlm_sql / drivers / rlm_sql_sqlite / rlm_sql_sqlite.c
index f0168b1..4b89d86 100644 (file)
@@ -45,7 +45,7 @@ RCSID("$Id$")
 #endif
 
 #ifndef HAVE_SQLITE3_INT64
-typedef sqlite3_int64 sqlite_int64
+typedef sqlite_int64 sqlite3_int64;
 #endif
 
 typedef struct rlm_sql_sqlite_conn {
@@ -665,6 +665,8 @@ static sql_rcode_t sql_fetch_row(rlm_sql_handle_t *handle, rlm_sql_config_t *con
 
        char **row;
 
+       TALLOC_FREE(handle->row);
+
        /*
         *      Executes the SQLite query and interates over the results
         */
@@ -691,11 +693,6 @@ static sql_rcode_t sql_fetch_row(rlm_sql_handle_t *handle, rlm_sql_config_t *con
                if (conn->col_count == 0) return RLM_SQL_ERROR;
        }
 
-       /*
-        *      Free the previous result (also gets called on finish_query)
-        */
-       talloc_free(handle->row);
-
        MEM(row = handle->row = talloc_zero_array(handle->conn, char *, conn->col_count + 1));
 
        for (i = 0; i < conn->col_count; i++) {