diff --git a/src/open.c b/src/open.c index 7a5228b..cc0c50f 100644 --- a/src/open.c +++ b/src/open.c @@ -150,7 +150,6 @@ void *aaruf_open(const char *filepath) // NOLINT(readability-function-size) TRACE("Allocating memory for context"); ctx = (aaruformatContext *)malloc(sizeof(aaruformatContext)); - memset(ctx, 0, sizeof(aaruformatContext)); if(ctx == NULL) { @@ -161,6 +160,8 @@ void *aaruf_open(const char *filepath) // NOLINT(readability-function-size) return NULL; } + memset(ctx, 0, sizeof(aaruformatContext)); + TRACE("Opening file %s", filepath); ctx->imageStream = fopen(filepath, "rb");