Skip to content

Commit

Permalink
Issue onOutOfMemoryError on bad malloc in Unique
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkline committed Apr 3, 2015
1 parent f6994ea commit db544d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion std/typecons.d
Expand Up @@ -97,7 +97,10 @@ public:
else
immutable size_t allocSize = T.sizeof;

void* rawMemory = enforce(malloc(allocSize), "malloc returned null");
void* rawMemory = malloc(allocSize);
if (!rawMemory)
onOutOfMemoryError();

u._p = cast(RefT)rawMemory;

static if (is(T == class)) {
Expand Down

0 comments on commit db544d5

Please sign in to comment.