Module: sip-router
Branch: master
Commit: cd6415240ff243842b4e11b095103f00fd64d0d9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cd64152…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Tue Sep 11 12:55:49 2012 +0100
modules_k/presence: Fixed some problems with for() loops in DB only mode
- Found and fixed by Hugh Waite @ Crocodile RCS Ltd
---
modules_k/presence/presence.c | 4 ++--
modules_k/presence/subscribe.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules_k/presence/presence.c b/modules_k/presence/presence.c
index 0adec43..ed7f4d1 100644
--- a/modules_k/presence/presence.c
+++ b/modules_k/presence/presence.c
@@ -1277,11 +1277,11 @@ static int update_pw_dialogs_dbonlymode(subs_t* subs, subs_t**
subs_array)
return 0;
}
+ rows = RES_ROWS(result);
/* get the results and fill in return data structure */
for (loop=0; loop <nr_rows; loop++)
{
- rows = RES_ROWS(result);
- row_vals = ROW_VALUES(rows);
+ row_vals = ROW_VALUES(&rows[loop]);
memset(&s, 0, sizeof(subs_t));
s.status= subs->status;
diff --git a/modules_k/presence/subscribe.c b/modules_k/presence/subscribe.c
index f8a9c1b..e98ef35 100644
--- a/modules_k/presence/subscribe.c
+++ b/modules_k/presence/subscribe.c
@@ -1688,6 +1688,7 @@ void update_db_subs_timer_notifier(void)
for (i = 0; i <RES_ROW_N(result); i++)
{
values = ROW_VALUES(&rows[i]);
+ memset(&subs, 0, sizeof(subs_t));
subs.callid.s = (char *) VAL_STRING(&values[r_callid_col]);
subs.callid.len = strlen(subs.callid.s);