summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/perlhost.h7
-rw-r--r--win32/win32.c13
2 files changed, 12 insertions, 8 deletions
diff --git a/win32/perlhost.h b/win32/perlhost.h
index 458ff9afc9..e52ba6d419 100644
--- a/win32/perlhost.h
+++ b/win32/perlhost.h
@@ -593,9 +593,10 @@ public:
}
if (0 == dwLen) {
sMsg = (char*)LocalAlloc(0, 64/**sizeof(TCHAR)*/);
- dwLen = sprintf(sMsg,
- "Unknown error #0x%lX (lookup 0x%lX)",
- dwErr, GetLastError());
+ if (sMsg)
+ dwLen = sprintf(sMsg,
+ "Unknown error #0x%lX (lookup 0x%lX)",
+ dwErr, GetLastError());
}
};
virtual void FreeBuf(char* sMsg)
diff --git a/win32/win32.c b/win32/win32.c
index 2fe8772d65..53048cb200 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1716,12 +1716,15 @@ win32_str_os_error(void *sv, DWORD dwErr)
}
if (0 == dwLen) {
sMsg = (char*)LocalAlloc(0, 64/**sizeof(TCHAR)*/);
- dwLen = sprintf(sMsg,
- "Unknown error #0x%lX (lookup 0x%lX)",
- dwErr, GetLastError());
+ if (sMsg)
+ dwLen = sprintf(sMsg,
+ "Unknown error #0x%lX (lookup 0x%lX)",
+ dwErr, GetLastError());
+ }
+ if (sMsg) {
+ sv_setpvn((SV*)sv, sMsg, dwLen);
+ LocalFree(sMsg);
}
- sv_setpvn((SV*)sv, sMsg, dwLen);
- LocalFree(sMsg);
}