Changeset 1097 for trunk/dll/notebook.c


Ignore:
Timestamp:
Jul 31, 2008, 8:35:00 PM (17 years ago)
Author:
John Small
Message:

Ticket 114: Improved code to avoid traps possibly caused by strings being freed
prematurely.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/notebook.c

    r1096 r1097  
    3838  19 Jul 08 JBS Ticket 197: Support accelerator keys in setting dialogs.
    3939  20 Jul 08 JBS Ticket 114: Support user-selectable env. strings in Tree container.
     40  31 Jul 08 JBS Ticket 114: Improved code to avoid traps.
    4041
    4142***********************************************************************/
     
    12901291                (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), WM_COMMAND,
    12911292                MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
    1292         PostMsg(hwndTree, UM_SHOWME, MPFROMP(pci->pszFileName), MPVOID);
    1293 
     1293        pszTemp = xmalloc(strlen(pci->pszFileName) + 1, pszSrcFile, __LINE__);
     1294        if (pszTemp) {
     1295          strcpy(pszTemp, pci->pszFileName);
     1296          PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszTemp), MPVOID);
     1297          /* pszTemp is freed in the UM_SHOWME code */
     1298        }
    12941299      }
    12951300    }
Note: See TracChangeset for help on using the changeset viewer.