File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,8 @@ class MemoryReader {
100
100
virtual ReadBytesResult
101
101
readBytes (RemoteAddress address, uint64_t size) {
102
102
auto *Buf = malloc (size);
103
+ if (!Buf)
104
+ return ReadBytesResult{};
103
105
ReadBytesResult Result (Buf, [](const void *ptr) {
104
106
free (const_cast <void *>(ptr));
105
107
});
Original file line number Diff line number Diff line change @@ -1802,6 +1802,9 @@ class MetadataReader {
1802
1802
MetadataRef _readMetadata (StoredPointer address, size_t sizeAfter) {
1803
1803
auto size = sizeAfter;
1804
1804
uint8_t *buffer = (uint8_t *) malloc (size);
1805
+ if (!buffer)
1806
+ return nullptr ;
1807
+
1805
1808
if (!Reader->readBytes (RemoteAddress (address), buffer, size)) {
1806
1809
free (buffer);
1807
1810
return nullptr ;
@@ -2522,6 +2525,8 @@ class MetadataReader {
2522
2525
std::string readObjCProtocolName (StoredPointer Address) {
2523
2526
auto Size = sizeof (TargetObjCProtocolPrefix<Runtime>);
2524
2527
auto Buffer = (uint8_t *)malloc (Size);
2528
+ if (!Buffer)
2529
+ return std::string ();
2525
2530
SWIFT_DEFER {
2526
2531
free (Buffer);
2527
2532
};
You can’t perform that action at this time.
0 commit comments