Module: kamailio
Branch: master
Commit: 29d7ca71fdfc8c52fb5e68fcf3bccf98dde0d089
URL:
https://github.com/kamailio/kamailio/commit/29d7ca71fdfc8c52fb5e68fcf3bccf9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-05-14T12:54:18+02:00
imc: better condition to catch no result of database query
---
Modified: modules/imc/imc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/29d7ca71fdfc8c52fb5e68fcf3bccf9…
Patch:
https://github.com/kamailio/kamailio/commit/29d7ca71fdfc8c52fb5e68fcf3bccf9…
---
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;
}