Changeset 1836 for trunk/dll/comp.c


Ignore:
Timestamp:
Jul 15, 2015, 2:48:14 AM (10 years ago)
Author:
Gregg Young
Message:

Fix trap in collector if a pci-pszFileName = NullStr and fix heap corruption problem and its related traps. This code reverts John double free fix. Ticket [551][555]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/comp.c

    r1686 r1836  
    9191                Added saymsg2 for this purpose
    9292  10 Mar 13 GKY Fixes to snapshot file.
     93  14 Jun 15 GKY Changes to prvenet access violations when cmp is freed
    9394
    9495***********************************************************************/
     
    944945#    endif
    945946  }
    946   else
     947  else {
     948    DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
    947949    free(cmp);
     950    cmp = NULL;
     951    DosReleaseMutexSem(hmtxFiltering);
     952  }
    948953}
    949954
     
    19941999            pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2;
    19952000            pcil->crtime.minutes = filesl[l]->crtime.minutes;
    1996             pcil->crtime.hours = filesl[l]->crtime.hours;
    1997             if (*cmp->dcd.mask.szMask) {
     2001            pcil->crtime.hours = filesl[l]->crtime.hours;
     2002            DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
     2003            if (cmp && *cmp->dcd.mask.szMask) {
    19982004              if (!Filter((PMINIRECORDCORE)pcil, (PVOID)&cmp->dcd.mask)) {
    19992005                pcil->rc.flRecordAttr |= CRA_FILTERED;
    20002006                pcir->rc.flRecordAttr |= CRA_FILTERED;
    2001               }
    2002             }
     2007              }
     2008            }
     2009            DosReleaseMutexSem(hmtxFiltering);
    20032010          } // if on left
    20042011
     
    20362043            pcir->crtime.minutes = filesr[r]->crtime.minutes;
    20372044            pcir->crtime.hours = filesr[r]->crtime.hours;
    2038             // Bypass check if already filtered on left side
    2039             if (~pcir->rc.flRecordAttr & CRA_FILTERED &&
     2045            // Bypass check if already filtered on left side
     2046            DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
     2047            if (cmp && ~pcir->rc.flRecordAttr & CRA_FILTERED &&
    20402048                *cmp->dcd.mask.szMask) {
    20412049              if (!Filter((PMINIRECORDCORE)pcir, (PVOID)&cmp->dcd.mask)) {
    20422050                pcil->rc.flRecordAttr |= CRA_FILTERED;
    20432051                pcir->rc.flRecordAttr |= CRA_FILTERED;
    2044               }
    2045             }
     2052              }
     2053            }
     2054            DosReleaseMutexSem(hmtxFiltering);
    20462055          } // if on right
    20472056
     
    22412250    WinTerminate(hab);
    22422251  }
     2252  DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
    22432253  free(cmp);
     2254  cmp = NULL;
     2255  DosReleaseMutexSem(hmtxFiltering);
    22442256  DosPostEventSem(CompactSem);
    22452257
     
    25662578        // 01 Aug 07 SHL if field null or blank, we draw
    25672579        // fixme to document why - probably to optimize and bypass draw?
    2568         if (pci && (INT)pci != -1 && !*pci->pszFileName)
     2580        if (pci && (INT)pci != -1 && !*pci->pszFileName && pci->pszFileName != NullStr)
    25692581          return MRFROMLONG(TRUE);
    25702582      }
     
    35423554          WinSendMsg(cmp->dcd.hwndObject, WM_CLOSE, MPVOID, MPVOID);
    35433555      }
     3556      DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
    35443557      free(cmp);
     3558      cmp = NULL;
     3559      DosReleaseMutexSem(hmtxFiltering);
    35453560    }
    35463561    EmptyCnr(GetHwndLeft(hwnd));
Note: See TracChangeset for help on using the changeset viewer.