Skip to content

Commit

Permalink
throw error on negative allocation size
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Jan 11, 2023
1 parent 76ca98f commit 2be3f7a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ void *hl_gc_alloc_gen( hl_type *t, int size, int flags ) {
int allocated = 0;
if( size == 0 )
return NULL;
if( size < 0 )
hl_error("Invalid allocation size");
gc_global_lock(true);
gc_check_mark();
# ifdef GC_MEMCHK
Expand Down

0 comments on commit 2be3f7a

Please sign in to comment.