aboutsummaryrefslogtreecommitdiffstats
path: root/cdr/cdr_odbc.c
diff options
context:
space:
mode:
authorjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2003-12-24 03:05:03 +0000
committerjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2003-12-24 03:05:03 +0000
commit5c45c7bedd94300a8403ebcb091d4db972aaa20c (patch)
tree6d34a289c76f539be1e509aa9ed954266be8fce8 /cdr/cdr_odbc.c
parent6fff8150e074d7132cd84a7620f4b4d8eb9ea91b (diff)
fix a small memory leak, from brian
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1880 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr/cdr_odbc.c')
-rwxr-xr-xcdr/cdr_odbc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c
index a54db7661..c9209a330 100755
--- a/cdr/cdr_odbc.c
+++ b/cdr/cdr_odbc.c
@@ -38,7 +38,7 @@ static char *desc = "ODBC CDR Backend";
static char *name = "ODBC";
static char *config = "cdr_odbc.conf";
static char *dsn = NULL, *username = NULL, *password = NULL, *loguniqueid = NULL;
-static int dsn_alloc = 0, username_alloc = 0, password_alloc = 0;
+static int dsn_alloc = 0, username_alloc = 0, password_alloc = 0, loguniqueid_alloc = 0;
static int connected = 0;
static ast_mutex_t odbc_lock = AST_MUTEX_INITIALIZER;
@@ -226,6 +226,14 @@ static int odbc_unload_module(void)
password = NULL;
password_alloc = 0;
}
+ if (loguniqueid && loguniqueid_alloc)
+ {
+ if(option_verbose > 3)
+ ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free loguniqueid\n");
+ free(loguniqueid);
+ loguniqueid = NULL;
+ loguniqueid_alloc = 0;
+ }
ast_cdr_unregister(name);
ast_mutex_unlock(&odbc_lock);
return 0;
@@ -323,11 +331,13 @@ static int odbc_load_module(void)
if (loguniqueid != NULL)
{
strcpy(loguniqueid,tmp);
+ loguniqueid_alloc = 1;
ast_log(LOG_WARNING,"cdr_odbc: Logging uniqueid\n");
}
else
{
ast_log(LOG_ERROR,"cdr_odbc: Not logging uniqueid\n");
+ loguniqueid_alloc = 1;
loguniqueid = NULL;
}
}