mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
zdb: follow-up to r326150, check if malloc succeeded
Reported by: rpokala MFC after: 1 week X-MFC with: r326150
This commit is contained in:
parent
3228add807
commit
718cb91ccc
1 changed files with 5 additions and 0 deletions
|
|
@ -3739,6 +3739,11 @@ zdb_embedded_block(char *thing)
|
|||
}
|
||||
ASSERT3U(BPE_GET_LSIZE(&bp), <=, SPA_MAXBLOCKSIZE);
|
||||
buf = malloc(SPA_MAXBLOCKSIZE);
|
||||
if (buf == NULL) {
|
||||
(void) fprintf(stderr, "%s: failed to allocate %llu bytes\n",
|
||||
__func__, SPA_MAXBLOCKSIZE);
|
||||
exit(1);
|
||||
}
|
||||
err = decode_embedded_bp(&bp, buf, BPE_GET_LSIZE(&bp));
|
||||
if (err != 0) {
|
||||
(void) printf("decode failed: %u\n", err);
|
||||
|
|
|
|||
Loading…
Reference in a new issue