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) {