libsmartcols: (sample) check scols_line_set_data() return code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
e19e522df0
commit
8aedaf592e
|
@ -134,6 +134,7 @@ static int parse_column_data(FILE *f, struct libscols_table *tb, int col)
|
|||
size_t len = 0, nlines = 0;
|
||||
int i;
|
||||
char *str = NULL;
|
||||
int rc;
|
||||
|
||||
while ((i = getline(&str, &len, f)) != -1) {
|
||||
|
||||
|
@ -151,8 +152,8 @@ static int parse_column_data(FILE *f, struct libscols_table *tb, int col)
|
|||
if (!ln)
|
||||
break;
|
||||
|
||||
if (str && *str)
|
||||
scols_line_set_data(ln, col, str);
|
||||
if (str && *str && scols_line_set_data(ln, col, str) != 0)
|
||||
err(EXIT_FAILURE, "failed to add output data");
|
||||
}
|
||||
|
||||
free(str);
|
||||
|
|
Loading…
Reference in New Issue