Hi Tom,
Updated, thanks!
Best Regards
Nan Xiao
Index: dmesg.c
===
RCS file: /cvs/src/sbin/dmesg/dmesg.c,v
retrieving revision 1.29
diff -u -p -r1.29 dmesg.c
--- dmesg.c 1 Sep 2017 07:31:45 - 1.29
+++ dmesg.c 4 Sep
> - free(allocated);
> + if (allocated)
> + free(allocated);
This is unnecessary, since free(NULL) is clearly defined as a no-op.
See the malloc(3) man page.
Tom
>>> Nan Xiao 4-Sep-17 12:11 >>>
>
> Hi tech@,
>
> This patch fixes the extreme case in dmesg.c: if memf or nlistf
Hi tech@,
This patch fixes the extreme case in dmesg.c: if memf or nlistf is not
NULL, and "NOKVM" macro is defined.
Current code in dmesg.c:
struct msgbuf cur;
Since "cur" is not initialized, so the following code has undefined
behavior:
if (cur.msg_bufx >=