free the row earlier
authorAlan T. DeKok <aland@freeradius.org>
Tue, 22 Mar 2016 15:38:30 +0000 (11:38 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 22 Mar 2016 15:38:30 +0000 (11:38 -0400)
src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c

index 97363f9..0b76d9a 100644 (file)
@@ -663,6 +663,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
         */
@@ -689,11 +691,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++) {