forked from lda/telodendria
Fix a memory bug in StrRandom() with RandIntN().
We're storing integers in this buffer, so we have to allocate enough memory for them. An integer is usually more than one byte.
This commit is contained in:
parent
38438c297e
commit
c78dc3bd31
2 changed files with 2 additions and 2 deletions
|
@ -171,7 +171,7 @@ StrRandom(size_t len)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nums = Malloc(len);
|
nums = Malloc(len * sizeof(int));
|
||||||
if (!nums)
|
if (!nums)
|
||||||
{
|
{
|
||||||
Free(str);
|
Free(str);
|
||||||
|
|
|
@ -36,7 +36,7 @@ CFLAGS="${CFLAGS} ${DEFINES} ${INCLUDES}"
|
||||||
LDFLAGS="${LDFLAGS} ${STATIC}"
|
LDFLAGS="${LDFLAGS} ${STATIC}"
|
||||||
|
|
||||||
if [ "$DEBUG" = "1" ]; then
|
if [ "$DEBUG" = "1" ]; then
|
||||||
CFLAGS="$CFLAGS -O0 -g"
|
CFLAGS="$CFLAGS -O0 -g -pg"
|
||||||
LDFLAGS="-lm -pthread -v"
|
LDFLAGS="-lm -pthread -v"
|
||||||
PROG="$PROG-debug"
|
PROG="$PROG-debug"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue