Module: sip-router Branch: 3.3 Commit: c2616fb78a9828203fbc9e885d96f07364df5000 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c2616fb7...
Author: Peter Dunkley peter.dunkley@crocodile-rcs.com Committer: Peter Dunkley peter.dunkley@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 (cherry picked from commit cd6415240ff243842b4e11b095103f00fd64d0d9)
---
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 7e90cce..ad43f7b 100644 --- a/modules_k/presence/subscribe.c +++ b/modules_k/presence/subscribe.c @@ -1641,6 +1641,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);