From d571d05431f621e2cf00036fa92d34b18ee8b162 Mon Sep 17 00:00:00 2001 From: tth Date: Fri, 2 Aug 2019 01:50:12 +0200 Subject: [PATCH] clean memory before use --- lib/fimg-file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/fimg-file.c b/lib/fimg-file.c index 00e4040d..84462701 100644 --- a/lib/fimg-file.c +++ b/lib/fimg-file.c @@ -74,6 +74,7 @@ if (NULL==fp) { return -1; } +memset(&filehead, 0, sizeof(filehead)); strcpy(filehead.magic, "FIMG"); filehead.w = fimg->width; filehead.h = fimg->height; filehead.t = fimg->type; @@ -138,6 +139,6 @@ if (foo) { foo = fread(head->R, sizeof(float), filehead.w*filehead.h*3, fp); fclose(fp); - + return 0; }