]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update sql
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 11 Dec 2007 20:50:52 +0000 (20:50 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 11 Dec 2007 20:50:52 +0000 (20:50 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6671 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_core_sqldb.c

index 194f20a5bf3e248dd76fa3f0cd34b9b3823ac74f..f9e6ce755665761e958f2f04208a9c48bb4befeb 100644 (file)
@@ -154,10 +154,12 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t * thread,
        uint8_t trans = 0, nothing_in_queue = 0;
        uint32_t target = 1000;
        switch_size_t len = 0, sql_len = SQLLEN;
-       char *sqlbuf = (char *) malloc(sql_len);
+       char *tmp, *sqlbuf = (char *) malloc(sql_len);
        char *sql;
        switch_size_t newlen;
 
+       switch_assert(sqlbuf);
+
        if (!sql_manager.event_db) {
                sql_manager.event_db = switch_core_db_handle();
        }
@@ -180,10 +182,12 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t * thread,
                                        itterations++;
                                        if (len + newlen > sql_len) {
                                                sql_len = len + SQLLEN;
-                                               if (!(sqlbuf = realloc(sqlbuf, sql_len))) {
+                                               if (!(tmp = realloc(sqlbuf, sql_len))) {
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread ending on mem err\n");
+                                                       abort();
                                                        break;
                                                }
+                                               sqlbuf = tmp;
                                        }
                                        sprintf(sqlbuf + len, "%s;\n", sql);
                                        len += newlen;