From e5f3baf6c110760b7a8a205dda834b1c4a2446e5 Mon Sep 17 00:00:00 2001 From: Dave West Date: Tue, 18 Mar 2008 14:59:28 +0000 Subject: [PATCH] RWHO command uses new function to read the context list safely. --- citadel/modules/rwho/serv_rwho.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/citadel/modules/rwho/serv_rwho.c b/citadel/modules/rwho/serv_rwho.c index 06f439081..515c5f6af 100644 --- a/citadel/modules/rwho/serv_rwho.c +++ b/citadel/modules/rwho/serv_rwho.c @@ -68,8 +68,7 @@ void cmd_rwho(char *argbuf) { */ - nContexts = num_sessions; - nptr = malloc(sizeof(struct CitContext) * nContexts); + nptr = CtdlGetContextArray(&nContexts) ; if (!nptr) { /* Couldn't malloc so we have to bail but stick to the protocol */ @@ -77,12 +76,6 @@ void cmd_rwho(char *argbuf) { cprintf("000\n"); return; } - begin_critical_section(S_SESSION_TABLE); - for (cptr = ContextList, i=0; cptr != NULL && i < nContexts; cptr = cptr->next, i++) - { - memcpy(&nptr[i], cptr, sizeof (struct CitContext)); - } - end_critical_section (S_SESSION_TABLE); aide = CC->user.axlevel >= 6; cprintf("%d%c \n", LISTING_FOLLOWS, CtdlCheckExpress() ); -- 2.30.2