From 7179aba632ed142824e0d3f1d098686497d6023a Mon Sep 17 00:00:00 2001 From: _ <_> Date: Sun, 1 Apr 2018 14:41:42 -0700 Subject: [PATCH] Fixed memory allocation size for struct PldHeader --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 85b90ca..6e353b9 100644 --- a/main.c +++ b/main.c @@ -14,7 +14,7 @@ void disp_pldheader(struct PldHeader *x) { bool read_pldheader(const char *buffer) { int32_t *n = (int32_t*)buffer; - struct PldHeader *ph = (struct PldHeader*)malloc(1); + struct PldHeader *ph = (struct PldHeader*)malloc(sizeof(struct PldHeader)); unsigned int size_offsets = sizeof(uint32_t) * n[0]; ph -> offsets = (uint32_t*)malloc(size_offsets); if (ph -> offsets == NULL) {