Commit e3a7c6c7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/monthcal: Fix memory leak on MCN_GETDAYSTATE notification.

parent 818aab58
......@@ -1233,7 +1233,7 @@ static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr)
if(infoPtr->dwStyle & MCS_DAYSTATE) {
NMDAYSTATE nmds;
int i;
INT i;
nmds.nmhdr.hwndFrom = infoPtr->hwndSelf;
nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
......@@ -1247,8 +1247,10 @@ static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr)
nmds.stStart.wDay = 1;
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmds.nmhdr.idFrom, (LPARAM)&nmds);
for(i=0; i<infoPtr->monthRange; i++)
for(i = 0; i < infoPtr->monthRange; i++)
infoPtr->monthdayState[i] = nmds.prgDayState[i];
Free(nmds.prgDayState);
}
}
......@@ -1265,14 +1267,13 @@ static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr)
if(infoPtr->dwStyle & MCS_DAYSTATE) {
NMDAYSTATE nmds;
int i;
INT i;
nmds.nmhdr.hwndFrom = infoPtr->hwndSelf;
nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
nmds.nmhdr.code = MCN_GETDAYSTATE;
nmds.cDayState = infoPtr->monthRange;
nmds.prgDayState = Alloc
(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
nmds.stStart = infoPtr->todaysDate;
nmds.stStart.wYear = infoPtr->curSel.wYear;
......@@ -1280,8 +1281,10 @@ static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr)
nmds.stStart.wDay = 1;
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmds.nmhdr.idFrom, (LPARAM)&nmds);
for(i=0; i<infoPtr->monthRange; i++)
for(i = 0; i < infoPtr->monthRange; i++)
infoPtr->monthdayState[i] = nmds.prgDayState[i];
Free(nmds.prgDayState);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment