Changeset 8755 for trunk/src


Ignore:
Timestamp:
Jun 25, 2002, 9:11:58 AM (23 years ago)
Author:
sandervl
Message:

KSO: Bad linked list walking. (accessed node after free)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shell32/changenotify.c

    r8614 r8755  
    1 /* $Id: changenotify.c,v 1.3 2002-06-09 12:41:20 sandervl Exp $ */
     1/* $Id: changenotify.c,v 1.4 2002-06-25 07:11:58 sandervl Exp $ */
    22/*
    33 *      shell change notification
     
    2626{
    2727        struct _NOTIFICATIONLIST *next;
    28         struct _NOTIFICATIONLIST *prev; 
     28        struct _NOTIFICATIONLIST *prev;
    2929        HWND hwnd;              /* window to notify */
    3030        DWORD uMsg;             /* message to send */
     
    5555
    5656        while(ptr != &tail)
    57         { 
     57        {
    5858          int i;
    5959          item = ptr;
     
    6161
    6262          TRACE("item=%p\n", item);
    63          
     63       
    6464          /* free the item */
    6565          for (i=0; i<item->cidl;i++) SHFree(item->apidl[i].pidlPath);
     
    106106
    107107        ptr = head.next;
     108#ifdef __WIN32OS2__
     109        while((ptr != &tail)/* && (ret == FALSE) see the rant below */)
     110#else
    108111        while((ptr != &tail) && (ret == FALSE))
    109         {
     112#endif
     113        {
    110114          TRACE("ptr=%p\n", ptr);
    111          
     115       
    112116          if (ptr == item)
    113117          {
    114118            int i;
    115            
     119       
    116120            TRACE("item=%p prev=%p next=%p\n", item, item->prev, item->next);
    117121
     
    124128            SHFree(item->apidl);
    125129            SHFree(item);
    126             ret = TRUE;
     130#ifdef __WIN32OS2__
     131            /* ret = TRUE;
     132             * <rant> HEY! Have you guys ever heard about the break keyword?
     133             * And please don't test if ret == FALSE. Test !ret!!! </rant>
     134             * Anyway, ptr == item, we free item hence the memory shouldn't be
     135             * accessed by us any longer. We have to break here so we do NOT do
     136             * the next operation below!
     137             * -bird-
     138             */
     139            break;
     140#else
     141            ret = TRUE;
     142#endif
    127143          }
    128144          ptr = ptr->next;
     
    222238        {
    223239          TRACE("trying %p\n", ptr);
    224          
     240       
    225241          if(wEventId & ptr->wEventMask)
    226242          {
     
    268284        {
    269285          TRACE("trying %p\n", ptr);
    270          
     286       
    271287          if(wEventId & ptr->wEventMask)
    272288          {
Note: See TracChangeset for help on using the changeset viewer.