]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: fix uninitialized local variable in sample
authorKarel Zak <kzak@redhat.com>
Mon, 23 Oct 2023 13:20:47 +0000 (15:20 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 23 Oct 2023 19:54:01 +0000 (21:54 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/samples/fromfile.c

index a921b20a9239612e488287ac2c8a21b7028cda84..631262f841a96c4bda6296ce6788f5e951208ba0 100644 (file)
@@ -141,7 +141,7 @@ static int parse_column_data(FILE *f, struct libscols_table *tb, int col)
 
        while ((i = getline(&str, &len, f)) != -1) {
                struct libscols_line *ln;
-               int rc;
+               int rc = 0;
 
                ln = scols_table_get_line(tb, nlines++);
                if (!ln)
@@ -162,7 +162,7 @@ static int parse_column_data(FILE *f, struct libscols_table *tb, int col)
 
                        len = unhexmangle_to_buffer(str, buf, len);
                        if (len)
-                               scols_cell_refer_memory(ce, buf, len);
+                               rc = scols_cell_refer_memory(ce, buf, len);
                } else
                        rc = scols_line_set_data(ln, col, str);
                if (rc)