Removed null-pointer dereference in low mem.
[umurmur.git] / src / pds.c
index 066666f13b6c402ac4c684e3e321907246d9b3a6..88339d0bd907ec2c81e6f3efef75bb055818dd38 100644 (file)
--- a/src/pds.c
+++ b/src/pds.c
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include "pds.h"
 #include "log.h"
+#include "memory.h"
 
 /*
  * Data serialization functions below
@@ -117,9 +118,7 @@ static inline uint64_t next(pds_t *pds)
 
 pds_t *Pds_create(uint8_t *buf, int size)
 {
-       pds_t *pds = malloc(sizeof(pds_t));
-       if (pds == NULL)
-               Log_fatal("Out of memory");
+       pds_t *pds = Memory_safeMalloc(1, sizeof(pds_t));
        pds->data = buf;
        pds->offset = pds->overshoot = 0;
        pds->maxsize = size;