Commit f05618bd authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Do not HeapFree() memory not allocated by us in COMBO_GetText.

Convert return value from LB_GETTEXT into COMBO_GetText.
parent 3ee02bab
...@@ -1498,6 +1498,9 @@ static LRESULT COMBO_ItemOp( LPHEADCOMBO lphc, UINT msg, LPARAM lParam ) ...@@ -1498,6 +1498,9 @@ static LRESULT COMBO_ItemOp( LPHEADCOMBO lphc, UINT msg, LPARAM lParam )
/*********************************************************************** /***********************************************************************
* COMBO_GetText * COMBO_GetText
*
* NOTE! LB_GETTEXT does not count terminating \0, WM_GETTEXT does.
* also LB_GETTEXT might return values < 0, WM_GETTEXT doesn't.
*/ */
static LRESULT COMBO_GetText( LPHEADCOMBO lphc, INT N, LPARAM lParam, BOOL unicode) static LRESULT COMBO_GetText( LPHEADCOMBO lphc, INT N, LPARAM lParam, BOOL unicode)
{ {
...@@ -1539,8 +1542,8 @@ static LRESULT COMBO_GetText( LPHEADCOMBO lphc, INT N, LPARAM lParam, BOOL unico ...@@ -1539,8 +1542,8 @@ static LRESULT COMBO_GetText( LPHEADCOMBO lphc, INT N, LPARAM lParam, BOOL unico
strncpyW(lpText, lpBuffer, (N > n) ? n+1 : N-1); strncpyW(lpText, lpBuffer, (N > n) ? n+1 : N-1);
lpText[N - 1] = '\0'; lpText[N - 1] = '\0';
} }
HeapFree( GetProcessHeap(), 0, lpBuffer );
} }
HeapFree( GetProcessHeap(), 0, lpBuffer );
} }
} }
else else
...@@ -1566,10 +1569,14 @@ static LRESULT COMBO_GetText( LPHEADCOMBO lphc, INT N, LPARAM lParam, BOOL unico ...@@ -1566,10 +1569,14 @@ static LRESULT COMBO_GetText( LPHEADCOMBO lphc, INT N, LPARAM lParam, BOOL unico
strncpy(lpText, lpBuffer, (N > n) ? n+1 : N-1); strncpy(lpText, lpBuffer, (N > n) ? n+1 : N-1);
lpText[N - 1] = '\0'; lpText[N - 1] = '\0';
} }
HeapFree( GetProcessHeap(), 0, lpBuffer );
} }
HeapFree( GetProcessHeap(), 0, lpBuffer );
} }
} }
if (n<0)
n=0;
else
n++;
return (LRESULT)n; return (LRESULT)n;
} }
} }
......
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