From 50e899abcb077f15bd7e72bd0a0ce2d934fb76db Mon Sep 17 00:00:00 2001 From: Krzysztof Jackiewicz Date: Fri, 13 May 2016 12:31:01 +0200 Subject: [PATCH] Prevent use of uninitialized variable in examples Change-Id: I79052b160cd3d009fe89652a33e0450ee1e516d3 --- examples/misc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/misc.c b/examples/misc.c index b3a8fdc..ef8c53c 100644 --- a/examples/misc.c +++ b/examples/misc.c @@ -54,7 +54,7 @@ int read_file(const char *path, char **data, size_t *data_len) int ret; char tmp[BUF_SIZE]; char *buf = NULL; - size_t buf_len; + size_t buf_len = 0; FILE *f; f = fopen(path, "r"); @@ -71,7 +71,6 @@ int read_file(const char *path, char **data, size_t *data_len) ret = -1; break; } - buf_len = 0; } else { char *new_buf = yaca_realloc(buf, buf_len + read); if (new_buf == NULL) { -- 2.34.1