summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys-utils/dmesg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index f96e5bdf7..f0b9b7137 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -1017,6 +1017,8 @@ full_output:
if (!line) {
mesg_copy = xstrdup(rec->mesg);
line = strtok(mesg_copy, "\n");
+ if (!line)
+ goto done; /* only when something is wrong */
mesg_size = strlen(line);
}
} else {
@@ -1057,6 +1059,7 @@ full_output:
free(mesg_copy);
}
+done:
putchar('\n');
}