1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Author: Michael Griffin <mrmisticismo@hotmail.com> vim:ft=diff:
Description: fix alloc size
--- a/src/internal.c
+++ b/src/internal.c
@@ -25,7 +25,7 @@
* it makes sure that malloc doesnt return NULL */
void *m_malloc(size_t size) {
void *p = (void *)NULL;
- p = malloc(size);
+ p = malloc(size * sizeof(int32_t));
if (!p) {
fprintf(stderr, "ERROR: malloc of %d bytes failed\n", size);
fprintf(stderr, "Exiting...\n");
@@ -49,6 +49,6 @@
/* this is a wrapper for realloc */
void *m_realloc(void *p, size_t size) {
- p = realloc(p, size);
+ p = realloc(p, size * sizeof(int32_t));
return p;
}
|