Skip to content

Commit

Permalink
PR go/65349
Browse files Browse the repository at this point in the history
runtime: Don't crash if explicitly freeing small map.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221292 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
ian committed Mar 9, 2015
1 parent 9d68290 commit 209b051
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libgo/runtime/go-map-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <stdlib.h>

#include "runtime.h"
#include "malloc.h"
#include "go-alloc.h"
#include "go-assert.h"
#include "map.h"
Expand Down Expand Up @@ -63,7 +64,8 @@ __go_map_rehash (struct __go_map *map)
}
}

__go_free (old_buckets);
if (old_bucket_count * sizeof (void *) >= TinySize)
__go_free (old_buckets);

map->__bucket_count = new_bucket_count;
map->__buckets = new_buckets;
Expand Down

0 comments on commit 209b051

Please sign in to comment.