diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | chooser.c | 39 | ||||
-rw-r--r-- | socket.c | 5 |
3 files changed, 41 insertions, 17 deletions
@@ -1,7 +1,19 @@ +2006-03-10 Alan Coopersmith <alan.coopersmith@sun.com> + + * chooser.c: + Coverity ids #722, 723, 724, 725, 726, 727, 728: + Need to XtFree the values returned by XawListShowCurrent to plug + memory leaks. + + * socket.c (UpdateMcastGroup): + Coverity id #834: + After joining a multicast group, add group pointer to the list of + active multicast groups instead of just leaking the group pointer. + 2006-03-09 Alan Coopersmith <alan.coopersmith@sun.com> * socket.c: (CreateSocklistEntry): - Coverity ids #7689, 7690, 7691: + Coverity id #332: When malloc fails, don't just print an error and continue on using the NULL pointer, return NULL to the caller. @@ -1,5 +1,5 @@ /* - * $XdotOrg: xc/programs/xdm/chooser.c,v 1.2 2004/04/23 19:54:42 eich Exp $ + * $XdotOrg: app/xdm/chooser.c,v 1.4 2005/11/08 06:33:31 jkj Exp $ * $Xorg: chooser.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group @@ -140,7 +140,7 @@ in this Software without prior written authorization from The Open Group. static int FromHex (char *s, char *d, int len); static int oldline; -Widget toplevel, label, viewport, paned, list, box, cancel, acceptit, ping; +static Widget toplevel, label, viewport, paned, list, box, cancel, acceptit, ping; static void CvtStringToARRAY8( XrmValuePtr args, @@ -1030,7 +1030,7 @@ Hostselect (int line) { XawListReturnStruct *r; HostName *h; - r = XawListShowCurrent (list); + /* Assume the next host is willing */ XawListHighlight (list,line); r = XawListShowCurrent (list); @@ -1047,7 +1047,7 @@ Hostselect (int line) Arg size[2]; Dimension height, portheight; Position y; - int lineheight, liney, newy = 0; + int lineheight, liney; XtSetArg (size[0], XtNheight, &height); XtSetArg (size[1], XtNy, &y); @@ -1066,10 +1066,12 @@ Hostselect (int line) (liney + lineheight) - portheight); } - return 1; + XtFree((char *) r); + return 1; } } - } + } + XtFree((char *) r); return 0; } @@ -1100,7 +1102,10 @@ Selectfirst (void) static void Storeold (Widget w, XEvent *event, String *params, Cardinal *num_params) { - oldline = (XawListShowCurrent(list))->list_index; + XawListReturnStruct *r = XawListShowCurrent(list); + + oldline = r->list_index; + XtFree((char *) r); } /* @@ -1165,6 +1170,7 @@ Switch_Key (Widget w, XEvent *event, String *params, Cardinal *num_params) else HostCycle(r->list_index,NameTableSize,keysym); + XtFree((char *) r); return; } @@ -1185,8 +1191,9 @@ Switch_Btn (Widget w, XEvent *event, String *params, Cardinal *num_params) Selectfirst(); else HostCycle(r->list_index,NameTableSize,event->xbutton.button); - - return; + + XtFree((char *) r); + return; } @@ -1213,6 +1220,7 @@ DoAccept (Widget w, XEvent *event, String *params, Cardinal *num_params) } exit (OBEYSESS_DISPLAY); } + XtFree((char *) r); } /* ARGSUSED */ @@ -1223,12 +1231,13 @@ DoCheckWilling (Widget w, XEvent *event, String *params, Cardinal *num_params) HostName *h; r = XawListShowCurrent (list); - if (r->list_index == XAW_LIST_NONE) - return; - for (h = hostNamedb; h; h = h->next) - if (!strcmp (r->string, h->fullname)) - if (!h->willing) - XawListUnhighlight (list); + if (r->list_index != XAW_LIST_NONE) { + for (h = hostNamedb; h; h = h->next) + if (!strcmp (r->string, h->fullname)) + if (!h->willing) + XawListUnhighlight (list); + } + XtFree((char *) r); } /* ARGSUSED */ @@ -1,4 +1,4 @@ -/* $XdotOrg: app/xdm/socket.c,v 1.4 2005/07/05 18:52:33 alanc Exp $ */ +/* $XdotOrg: app/xdm/socket.c,v 1.5 2006/03/10 00:48:16 alanc Exp $ */ /* $Xorg: socket.c,v 1.4 2001/02/09 02:05:40 xorgcvs Exp $ */ /* @@ -461,6 +461,9 @@ UpdateMcastGroup(ARRAY8Ptr addr, void **closure) return; ChangeMcastMembership(s, g, JOIN_MCAST_GROUP); + g->ref = 1; + g->next = s->mcastgroups; + s->mcastgroups = g; } /* Open or close listening sockets to match the current settings read in |