Module: kamailio
Branch: 4.2
Commit: bae153942524b1d86e29f10208e35dbf088d7db5
URL:
https://github.com/kamailio/kamailio/commit/bae153942524b1d86e29f10208e35db…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-05-19T09:29:14+02:00
imc: better condition to catch no result of database query
(cherry picked from commit 29d7ca71fdfc8c52fb5e68fcf3bccf98dde0d089)
---
Modified: modules/imc/imc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bae153942524b1d86e29f10208e35db…
Patch:
https://github.com/kamailio/kamailio/commit/bae153942524b1d86e29f10208e35db…
---
diff --git a/modules/imc/imc.c b/modules/imc/imc.c
index f54b2be..8fbfd14 100644
--- a/modules/imc/imc.c
+++ b/modules/imc/imc.c
@@ -200,10 +200,10 @@ int add_from_db(void)
LM_ERR("failed to querry table\n");
return -1;
}
- if(r_res && r_res->n<=0)
+ if(r_res==NULL || r_res->n<=0)
{
LM_INFO("the query returned no result\n");
- imc_dbf.free_result(imc_db, r_res);
+ if(r_res) imc_dbf.free_result(imc_db, r_res);
r_res = NULL;
return 0;
}