]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
CID 1020958: Fix double unlock
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 26 May 2017 13:28:39 +0000 (09:28 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 26 May 2017 13:28:49 +0000 (09:28 -0400)
src/modules/rlm_sql/drivers/rlm_sql_firebird/rlm_sql_firebird.c

index b8a76466cb11ef649963fb48127e03488a4b67da..3f768cfe6f7cee9518058488c872e0d1118cb8e4 100644 (file)
@@ -145,11 +145,11 @@ static sql_rcode_t sql_query(rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t *
        }
 
        if (conn->statement_type != isc_info_sql_stmt_select) {
-               if (fb_commit(conn)) goto fail;
+               if (fb_commit(conn)) goto fail; /* fb_commit unlocks the mutex */
+       } else {
+               pthread_mutex_unlock(&conn->mut);
        }
 
-       pthread_mutex_unlock(&conn->mut);
-
        return 0;
 }