Commit 24ced30
util/mem: fix NULL dereference in nvme_realloc() on allocation failure
If nvme_alloc() fails and returns NULL, the subsequent memcpy() would
dereference a NULL pointer, resulting in undefined behavior. Add a NULL
check on the result of nvme_alloc() and return NULL early, consistent
with standard realloc() semantics where the original pointer remains
valid on failure.
Signed-off-by: Jim Munn <[email protected]>1 parent e89daf6 commit 24ced30
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
0 commit comments