kernel32/profile: Add a few NULL checks (Coverity).
This commit is contained in:
parent
0230695a29
commit
4a431afd69
|
@ -1322,7 +1322,13 @@ UINT WINAPI GetPrivateProfileIntA( LPCSTR section, LPCSTR entry,
|
||||||
INT WINAPI GetPrivateProfileSectionW( LPCWSTR section, LPWSTR buffer,
|
INT WINAPI GetPrivateProfileSectionW( LPCWSTR section, LPWSTR buffer,
|
||||||
DWORD len, LPCWSTR filename )
|
DWORD len, LPCWSTR filename )
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
if (!section || !buffer)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("(%s, %p, %d, %s)\n", debugstr_w(section), buffer, len, debugstr_w(filename));
|
TRACE("(%s, %p, %d, %s)\n", debugstr_w(section), buffer, len, debugstr_w(filename));
|
||||||
|
|
||||||
|
@ -1346,9 +1352,14 @@ INT WINAPI GetPrivateProfileSectionA( LPCSTR section, LPSTR buffer,
|
||||||
LPWSTR bufferW;
|
LPWSTR bufferW;
|
||||||
INT retW, ret = 0;
|
INT retW, ret = 0;
|
||||||
|
|
||||||
bufferW = buffer ? HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)) : NULL;
|
if (!section || !buffer)
|
||||||
if (section) RtlCreateUnicodeStringFromAsciiz(§ionW, section);
|
{
|
||||||
else sectionW.Buffer = NULL;
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||||
|
RtlCreateUnicodeStringFromAsciiz(§ionW, section);
|
||||||
if (filename) RtlCreateUnicodeStringFromAsciiz(&filenameW, filename);
|
if (filename) RtlCreateUnicodeStringFromAsciiz(&filenameW, filename);
|
||||||
else filenameW.Buffer = NULL;
|
else filenameW.Buffer = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue