Commit 1135fc39 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime: fix crash if user sets MemProfileRate=0

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5284044
parent fc61ea3b
......@@ -220,7 +220,8 @@ runtime·allocmcache(void)
rate = runtime·MemProfileRate;
if(rate > 0x3fffffff) // make 2*rate not overflow
rate = 0x3fffffff;
c->next_sample = runtime·fastrand1() % (2*rate);
if(rate != 0)
c->next_sample = runtime·fastrand1() % (2*rate);
return c;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment