diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-12-13 18:25:06 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-12-13 18:25:06 +0000 |
commit | 093ace5c24edf82f49fbee9b554fe95e108a8e63 (patch) | |
tree | 56315ffba3177a036b6c412c71347aa9eee53e49 /ui/win32 | |
parent | 4cabb63481e5841ff78aa697551f3bf7fd33a232 (diff) |
Fix Visual Studio Code Analysis warning C6011: Dereferencing NULL pointer 'returnedDevmode'
svn path=/trunk/; revision=54051
Diffstat (limited to 'ui/win32')
-rw-r--r-- | ui/win32/print_win32.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/win32/print_win32.c b/ui/win32/print_win32.c index 16e5fb2b02..69fadb88ae 100644 --- a/ui/win32/print_win32.c +++ b/ui/win32/print_win32.c @@ -130,6 +130,14 @@ static HDC get_printer_dc(short *width, short *height) /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd162931%28v=vs.85%29.aspx */ returnedDevmode = (PDEVMODE)GlobalLock(pdlg.hDevMode); + if (returnedDevmode == NULL) { + if (pdlg.hDevMode) + GlobalFree(pdlg.hDevMode); + if (pdlg.hDevNames) + GlobalFree(pdlg.hDevNames); + return NULL; + } + if (returnedDevmode->dmOrientation == DMORIENT_LANDSCAPE) { *width = returnedDevmode->dmPaperLength; *height = returnedDevmode->dmPaperWidth; |