]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
db: Initialize condition primitive before use
authorSean Bright <sean.bright@gmail.com>
Fri, 27 Dec 2019 23:29:45 +0000 (18:29 -0500)
committerSean Bright <sean.bright@gmail.com>
Fri, 27 Dec 2019 23:29:45 +0000 (18:29 -0500)
The db_init() function ultimately calls db_sync() which signals the
condition before it is initialized.

Change-Id: Id4a4e025b637bc4ac7d90557fcb71d56598892ab

main/db.c

index 4d1b37242d73f9bf900c6fb69b209d947e675000..193bd2e0de6472597e1008d4fe2066e7d210d271 100644 (file)
--- a/main/db.c
+++ b/main/db.c
@@ -1083,11 +1083,12 @@ static void astdb_atexit(void)
 
 int astdb_init(void)
 {
+       ast_cond_init(&dbcond, NULL);
+
        if (db_init()) {
                return -1;
        }
 
-       ast_cond_init(&dbcond, NULL);
        if (ast_pthread_create_background(&syncthread, NULL, db_sync_thread, NULL)) {
                return -1;
        }