This solves a crash in the cdr_tds module on 'stop gracefully', for situations where...
authorSteve Murphy <murf@digium.com>
Tue, 17 Jun 2008 20:00:36 +0000 (20:00 +0000)
committerSteve Murphy <murf@digium.com>
Tue, 17 Jun 2008 20:00:36 +0000 (20:00 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123446 65c4cc65-6c06-0410-ace0-fbb531ad65f3

cdr/cdr_tds.c

index 2991df1..235e1a6 100644 (file)
@@ -291,6 +291,9 @@ static void get_date(char *dateField, struct timeval tv)
 
 static int mssql_disconnect(void)
 {
+       if (!settings)
+               return 0;
+       
        if (settings->tds) {
                tds_free_socket(settings->tds);
                settings->tds = NULL;
@@ -399,9 +402,12 @@ connect_fail:
 
 static void cdr_tds_config_destroy(void)
 {
-       ast_mutex_destroy(&settings->lock);
-       ast_string_field_free_memory(settings);
-       ast_free(settings);     
+       if (settings)
+       {
+               ast_mutex_destroy(&settings->lock);
+               ast_string_field_free_memory(settings);
+               ast_free(settings);     
+       }
 }
 
 static int tds_unload_module(void)