From: Masatake YAMATO Date: Sat, 13 Nov 2021 10:14:34 +0000 (+0900) Subject: lsfd: don't define a local variable in the middle of a block X-Git-Tag: v2.38-rc1~144^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f7d3562fec91c7711269295d3b5c1d3457e8f9d;p=thirdparty%2Futil-linux.git lsfd: don't define a local variable in the middle of a block Signed-off-by: Masatake YAMATO --- diff --git a/misc-utils/lsfd.c b/misc-utils/lsfd.c index fc721982e6..111abd6027 100644 --- a/misc-utils/lsfd.c +++ b/misc-utils/lsfd.c @@ -253,12 +253,14 @@ static struct libscols_column *add_column(struct libscols_table *tb, const struc static struct libscols_column *add_column_by_id_cb(struct libscols_table *tb, int colid, void *data) { + struct libscols_column *cl; + if (ncolumns >= ARRAY_SIZE(columns)) errx(EXIT_FAILURE, _("too many columns are added via filter expression")); assert(colid < LSFD_N_COLS); - struct libscols_column *cl = add_column(tb, infos + colid); + cl = add_column(tb, infos + colid); if (!cl) err(EXIT_FAILURE, _("failed to allocate output column")); columns[ncolumns++] = colid;