Fixed memory allocation size for struct PldHeader

This commit is contained in:
_ 2018-04-01 14:41:42 -07:00
parent a67fa5a952
commit 7179aba632

2
main.c
View File

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