Changeset 1009 for trunk/dll/comp.c


Ignore:
Timestamp:
May 10, 2008, 9:51:58 AM (17 years ago)
Author:
Steven Levine
Message:

Add xfree xstrdup Fortify support
Add MT capable Fortify scope logic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/comp.c

    r1000 r1009  
    8181#include "notebook.h"                   // External compare/dircompare
    8282
     83#include "fortify.h"                    // 06 May 08 SHL
     84
    8385typedef struct
    8486{
     
    144146        DosFindClose(hdir);
    145147      }
    146       xfree(mask);
     148      xfree(mask, pszSrcFile, __LINE__);
    147149    }
    148     xfree(pffb);
     150    xfree(pffb, pszSrcFile, __LINE__);
    149151  }
    150152}
     
    178180      }
    179181    }
    180     xfree(sf);
     182    xfree(sf, pszSrcFile, __LINE__);
    181183  }
    182184}
     
    485487                pciD->flags = 0;        // Just on one side
    486488                if (pciD->pszSubject != NullStr) {
    487                   xfree(pciD->pszSubject);
     489                  xfree(pciD->pszSubject, pszSrcFile, __LINE__);
    488490                  pciD->pszSubject = NullStr;
    489491                }
     
    533535              pciD->pszLongName = pciS->pszLongName;
    534536              if (pciD->pszSubject != NullStr) {
    535                 xfree(pciD->pszSubject);
     537                xfree(pciD->pszSubject, pszSrcFile, __LINE__);
    536538                pciD->pszSubject = NullStr;
    537539              }
     
    549551
    550552              if (pciS->pszFileName != NullStr) {
    551                 xfree(pciS->pszFileName);
     553                xfree(pciS->pszFileName, pszSrcFile, __LINE__);
    552554                pciS->pszFileName = NullStr;
    553555                pciS->pszDisplayName = pciS->pszFileName;
     
    555557              }
    556558              if (pciS->pszSubject != NullStr) {
    557                 xfree(pciS->pszSubject);
     559                xfree(pciS->pszSubject, pszSrcFile, __LINE__);
    558560                pciS->pszSubject = NullStr;
    559561              }
     
    650652              // Forget status until we regenerate it
    651653              if (pciS->pszSubject != NullStr) {
    652                 xfree(pciS->pszSubject);
     654                xfree(pciS->pszSubject, pszSrcFile, __LINE__);
    653655                pciS->pszSubject = NullStr;
    654656              }
     
    682684    WinTerminate(hab);
    683685  }
    684   xfree(cmp);
     686  xfree(cmp, pszSrcFile, __LINE__);
    685687}
    686688
     
    739741    WinTerminate(hab);
    740742  }
    741   xfree(cmp);
     743  xfree(cmp, pszSrcFile, __LINE__);
    742744}
    743745
     
    784786  pciSa = xmalloc(sizeof(PCNRITEM) * numS, pszSrcFile, __LINE__);
    785787  if (!pciSa) {
    786     xfree(pciDa);
     788    xfree(pciDa, pszSrcFile, __LINE__);
    787789    return;
    788790  }
     
    817819      goto Restart;
    818820    }
    819     xfree(pciDa);
    820     xfree(pciSa);
     821    xfree(pciDa, pszSrcFile, __LINE__);
     822    xfree(pciSa, pszSrcFile, __LINE__);
    821823    Runtime_Error(pszSrcFile, __LINE__, "numD %u != x %lu", numD, x);
    822824    return;
     
    844846      goto Restart;
    845847    }
    846     xfree(pciSa);
    847     xfree(pciDa);
     848    xfree(pciSa, pszSrcFile, __LINE__);
     849    xfree(pciDa, pszSrcFile, __LINE__);
    848850    Runtime_Error(pszSrcFile, __LINE__, "numS (%lu) != x (%lu)", numS, x);
    849851    return;
     
    12881290  }
    12891291
    1290   xfree(pciSa);
    1291   xfree(pciDa);
     1292  xfree(pciSa, pszSrcFile, __LINE__);
     1293  xfree(pciDa, pszSrcFile, __LINE__);
    12921294
    12931295  if (fUpdateHideButton) {
     
    13301332  pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__);
    13311333  if (!pffbArray) {
    1332     xfree(maskstr);
     1334    xfree(maskstr, pszSrcFile, __LINE__);
    13331335    return;
    13341336  }
     
    13781380            // Complain if pathnames exceeds max
    13791381            DosFindClose(hDir);
    1380             xfree(pffbArray);
    1381             xfree(maskstr);
     1382            xfree(pffbArray, pszSrcFile, __LINE__);
     1383            xfree(maskstr, pszSrcFile, __LINE__);
    13821384            if (!fDone) {
    13831385              fDone = TRUE;
     
    14121414  }
    14131415
    1414   xfree(maskstr);
    1415   xfree(pffbArray);
     1416  xfree(maskstr, pszSrcFile, __LINE__);
     1417  xfree(pffbArray, pszSrcFile, __LINE__);
    14161418
    14171419  // DbgMsg(pszSrcFile, __LINE__, "FillDirList finish %s", str);
     
    14441446  CNRINFO cnri;
    14451447
     1448# ifdef FORTIFY
     1449  // 10 May 08 SHL fixme to suppress W111
     1450  Fortify_EnterScope();
     1451# endif
     1452
    14461453  if (!cmp) {
    14471454    Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     1455# ifdef FORTIFY
     1456    // 10 May 08 SHL fixme to suppress W111
     1457    Fortify_LeaveScope();
     1458# endif
    14481459    _endthread();
    14491460  }
     
    19942005        } // if insufficient resources
    19952006
    1996           xfree(filesl);                        // Free header - have already freed elements
     2007          xfree(filesl, pszSrcFile, __LINE__);                  // Free header - have already freed elements
    19972008        filesl = NULL;
    1998           xfree(filesr);
     2009          xfree(filesr, pszSrcFile, __LINE__);
    19992010        filesr = NULL;
    20002011
     
    20632074    WinTerminate(hab);
    20642075  }
    2065   xfree(cmp);
     2076  xfree(cmp, pszSrcFile, __LINE__);
    20662077  DosPostEventSem(CompactSem);
     2078
     2079# ifdef FORTIFY
     2080  // 10 May 08 SHL fixme to suppress W111
     2081  Fortify_LeaveScope();
     2082# endif
    20672083
    20682084  // DbgMsg(pszSrcFile, __LINE__, "FillCnrsThread exit");
     
    26242640                        GetPString(IDS_COULDNTSTARTTHREADTEXT));
    26252641          WinDismissDlg(hwnd, 0);
    2626           xfree(forthread);
     2642          xfree(forthread, pszSrcFile, __LINE__);
    26272643        }
    26282644        else {
     
    29042920              Runtime_Error(pszSrcFile, __LINE__,
    29052921                            GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2906               xfree(sf);
     2922              xfree(sf, pszSrcFile, __LINE__);
    29072923            }
    29082924          }
     
    29562972            Runtime_Error(pszSrcFile, __LINE__,
    29572973                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2958             xfree(forthread);
     2974            xfree(forthread, pszSrcFile, __LINE__);
    29592975          }
    29602976          else {
     
    30793095            Runtime_Error(pszSrcFile, __LINE__,
    30803096                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    3081             xfree(forthread);
     3097            xfree(forthread, pszSrcFile, __LINE__);
    30823098          }
    30833099          else {
     
    32353251          WinSendMsg(cmp->dcd.hwndObject, WM_CLOSE, MPVOID, MPVOID);
    32363252      }
    3237       xfree(cmp);
     3253      xfree(cmp, pszSrcFile, __LINE__);
    32383254    }
    32393255    EmptyCnr(hwndLeft);
Note: See TracChangeset for help on using the changeset viewer.