projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
* patch #3967: Create a mh_xrealloc function to prevent mistakes when
[mmh]
/
sbr
/
utils.c
diff --git
a/sbr/utils.c
b/sbr/utils.c
index
bc17177
..
7dfe900
100644
(file)
--- a/
sbr/utils.c
+++ b/
sbr/utils.c
@@
-27,3
+27,18
@@
mh_xmalloc(size_t size)
return memory;
}
+
+void *
+mh_xrealloc(void *ptr, size_t size)
+{
+ void *memory;
+
+ if (size == 0)
+ adios(NULL, "Tried to realloc 0bytes");
+
+ memory = realloc(ptr, size);
+ if (!memory)
+ adios(NULL, "Realloc failed");
+
+ return memory;
+}