From 97721eb583806b8deebcf708630ba1e54eed6324 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sun, 12 Mar 2017 03:50:13 +0000 Subject: [PATCH] libc: small cleanup. Initialize newsize in the code section so we avoids asigning the value if we exit early. --- lib/libc/stdio/printf-pos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libc/stdio/printf-pos.c b/lib/libc/stdio/printf-pos.c index 9c38c2add343..b81e27a2d64b 100644 --- a/lib/libc/stdio/printf-pos.c +++ b/lib/libc/stdio/printf-pos.c @@ -641,12 +641,13 @@ __grow_type_table(struct typetable *types) enum typeid *const oldtable = types->table; const int oldsize = types->tablesize; enum typeid *newtable; - u_int n, newsize = oldsize * 2; + u_int n, newsize; /* Detect overflow */ if (types->nextarg > NL_ARGMAX) return (-1); + newsize = oldsize * 2; if (newsize < types->nextarg + 1) newsize = types->nextarg + 1; if (oldsize == STATIC_ARG_TBL_SIZE) {