mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 03:49:02 +00:00
seq: fix potential NULL ptr reference
asprintf(3) allocates memory, and there isn't any guarantee of success. MFC after: 2 weeks Obtained from: OpenBSD
This commit is contained in:
parent
c5e957ad4f
commit
94c4f663ba
@ -199,8 +199,12 @@ main(int argc, char *argv[])
|
||||
* loop held true due to a rounding error and we still need to print
|
||||
* 'last'.
|
||||
*/
|
||||
asprintf(&cur_print, fmt, cur);
|
||||
asprintf(&last_print, fmt, last);
|
||||
if (asprintf(&cur_print, fmt, cur) < 0) {
|
||||
err(1, "asprintf");
|
||||
}
|
||||
if (asprintf(&last_print, fmt, last) < 0) {
|
||||
err(1, "asprintf");
|
||||
}
|
||||
if (strcmp(cur_print, last_print) == 0 && cur != last_shown_value) {
|
||||
fputs(last_print, stdout);
|
||||
fputs(sep, stdout);
|
||||
|
Loading…
Reference in New Issue
Block a user