summaryrefslogtreecommitdiff
path: root/cel
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-09-05 02:26:54 +0000
committerMatthew Jordan <mjordan@digium.com>2012-09-05 02:26:54 +0000
commitd88f91c8d0848f39b4d808767c91771f1337bb5f (patch)
tree315594180b6ac5ff775c3995c3b1e3ae8cc77bb6 /cel
parent4272ec14c5762d326d334b50b43443d847f0e508 (diff)
Fix memory leak when CEL is successfully written to PostgreSQL database
PQClear is not called when the result object of a call to PQExec has a status of PGRES_COMMAND_OK. Interestingly enough, the off nominal case was handled properly, so this memory leak only occurred when CEL records were successfully written. This patch properly clears the result in the nominal code path. (closes issue ASTERISK-19991) Reported by: Etienne Lessard Tested by: Etienne Lessard patches: mem_leak_cel_pgsql.patch uploaded by Etienne Lessard (license #6394) ........ Merged revisions 372158 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 372165 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 372175 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372176 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'cel')
-rw-r--r--cel/cel_pgsql.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/cel/cel_pgsql.c b/cel/cel_pgsql.c
index f7676f88e..5885a1d32 100644
--- a/cel/cel_pgsql.c
+++ b/cel/cel_pgsql.c
@@ -332,6 +332,7 @@ static void pgsql_log(const struct ast_event *event, void *userdata)
PQclear(result);
goto ast_log_cleanup;
}
+ PQclear(result);
ast_log_cleanup:
ast_free(sql);