aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-03-09 23:43:16 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-03-09 23:43:16 +0000
commitdc4d494ae91b055b0b2cac39a6aaa8c6352f09c8 (patch)
treeee68a97d9bc6e777780ba979db45c56acc20db19
parent4729d7726bdc86c46aeb525270909b73490ce206 (diff)
downloadgcc-dc4d494ae91b055b0b2cac39a6aaa8c6352f09c8.zip
gcc-dc4d494ae91b055b0b2cac39a6aaa8c6352f09c8.tar.gz
gcc-dc4d494ae91b055b0b2cac39a6aaa8c6352f09c8.tar.bz2
re PR go/65349 (go tool crashes, can't compile go code on 32bit linux systems)
PR go/65349 runtime: Don't crash if explicitly freeing small map. From-SVN: r221292
-rw-r--r--libgo/runtime/go-map-index.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libgo/runtime/go-map-index.c b/libgo/runtime/go-map-index.c
index 499641c..616b00c6 100644
--- a/libgo/runtime/go-map-index.c
+++ b/libgo/runtime/go-map-index.c
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include "runtime.h"
+#include "malloc.h"
#include "go-alloc.h"
#include "go-assert.h"
#include "map.h"
@@ -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;