[sr-dev] git:master:a361686b: purple: Fix multiple memory leaks in DB code
Phil Lavin
phil at lavin.me.uk
Mon Sep 19 23:04:42 CEST 2016
Module: kamailio
Branch: master
Commit: a361686b2c872cad6493804eb71b8b8e7e151a4f
URL: https://github.com/kamailio/kamailio/commit/a361686b2c872cad6493804eb71b8b8e7e151a4f
Author: Phil Lavin <phil at lavin.me.uk>
Committer: Phil Lavin <phil at lavin.me.uk>
Date: 2016-09-19T21:27:25+01:00
purple: Fix multiple memory leaks in DB code
---
Modified: modules/purple/mapping.c
---
Diff: https://github.com/kamailio/kamailio/commit/a361686b2c872cad6493804eb71b8b8e7e151a4f.diff
Patch: https://github.com/kamailio/kamailio/commit/a361686b2c872cad6493804eb71b8b8e7e151a4f.patch
---
diff --git a/modules/purple/mapping.c b/modules/purple/mapping.c
index e1aa00e..bbdb69f 100644
--- a/modules/purple/mapping.c
+++ b/modules/purple/mapping.c
@@ -133,8 +133,11 @@ char *find_sip_user(char *extern_user) {
if (result == NULL)
return NULL;
- if (result->n <= 0)
+
+ if (result->n <= 0) {
+ pa_dbf.free_result(pa_db, result);
return NULL;
+ }
row = &result->rows[0];
row_vals = ROW_VALUES(row);
@@ -208,6 +211,7 @@ extern_account_t *find_accounts(char* sip_user, int* count) {
return NULL;
}
if (result->n <= 0) {
+ pa_dbf.free_result(pa_db, result);
LM_ERR("result count = %d\n", result->n);
return NULL;
}
@@ -290,8 +294,11 @@ extern_user_t *find_users(char *sip_user, int* count) {
if (result == NULL)
return NULL;
- if (result->n <= 0)
+
+ if (result->n <= 0) {
+ pa_dbf.free_result(pa_db, result);
return NULL;
+ }
users = (extern_user_t*) pkg_malloc(sizeof(extern_user_t)*result->n);
More information about the sr-dev
mailing list