[llvm-objcopy] [COFF] Don't call memcpy() with a null argument. NFC.

It is invalid to call memcpy with a null pointer, even if the size
is zero.

This should fix the sanitizer buildbot.

llvm-svn: 349808
This commit is contained in:
Martin Storsjo 2018-12-20 19:48:39 +00:00
parent f17421e595
commit 02e96dd039
1 changed files with 2 additions and 1 deletions

View File

@ -225,7 +225,8 @@ void COFFWriter::writeSections() {
S.Header.SizeOfRawData - S.Contents.size());
Ptr += S.Header.SizeOfRawData;
memcpy(Ptr, S.Relocs.data(), S.Relocs.size() * sizeof(coff_relocation));
if (!S.Relocs.empty())
memcpy(Ptr, S.Relocs.data(), S.Relocs.size() * sizeof(coff_relocation));
}
}