]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
irqtop: check scols_line_set_data() return code
authorKarel Zak <kzak@redhat.com>
Thu, 25 Feb 2021 13:37:17 +0000 (14:37 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 25 Feb 2021 13:37:17 +0000 (14:37 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/irq-common.c

index 4fb064251fa41cb1235dad843588a583fe4531bf..b066e4ba7f825793a25a2260d44d3756861ed09c 100644 (file)
@@ -465,10 +465,8 @@ struct libscols_table *get_scols_cpus_table(struct irq_output *out,
 
        /* per cpu % of total */
        ln = new_scols_line(table);
-       if (!ln)
+       if (!ln || (!out->json && scols_line_set_data(ln, 0, "%irq:") != 0))
                goto err;
-       if (!out->json)
-               scols_line_set_data(ln, 0, "%irq:");
 
        for (i = 0; i < curr->nr_active_cpu; i++) {
                struct irq_cpu *cpu = &curr->cpus[i];
@@ -481,10 +479,8 @@ struct libscols_table *get_scols_cpus_table(struct irq_output *out,
 
        /* per cpu % of delta */
        ln = new_scols_line(table);
-       if (!ln)
+       if (!ln || (!out->json && scols_line_set_data(ln, 0, _("%delta:")) != 0))
                goto err;
-       if (!out->json)
-               scols_line_set_data(ln, 0, _("%delta:"));
 
        for (i = 0; i < curr->nr_active_cpu; i++) {
                struct irq_cpu *cpu = &curr->cpus[i];