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

Commit

Permalink
Realloc to size 0 data returns null, so avoid that situation.
Browse files Browse the repository at this point in the history
  • Loading branch information
schveiguy committed Aug 11, 2016
1 parent bd1ebb5 commit 35ccbc1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rt/minfo.d
Expand Up @@ -417,6 +417,13 @@ struct ModuleGroup
processMod(idx);
}

if (ctoridx == 0)
{
// no ctors in the list.
.free(ctors);
return null;
}

ctors = cast(immutable(ModuleInfo)**).realloc(ctors, ctoridx * (void*).sizeof);
if (ctors is null)
assert(0);
Expand Down

0 comments on commit 35ccbc1

Please sign in to comment.