Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 35ccbc1

Browse files
committed
Realloc to size 0 data returns null, so avoid that situation.
1 parent bd1ebb5 commit 35ccbc1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/rt/minfo.d

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,13 @@ struct ModuleGroup
417417
processMod(idx);
418418
}
419419

420+
if (ctoridx == 0)
421+
{
422+
// no ctors in the list.
423+
.free(ctors);
424+
return null;
425+
}
426+
420427
ctors = cast(immutable(ModuleInfo)**).realloc(ctors, ctoridx * (void*).sizeof);
421428
if (ctors is null)
422429
assert(0);

0 commit comments

Comments
 (0)