mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 02:44:41 +03:00
zpool: import: use realloc for realloc, remove strtok
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12094
This commit is contained in:
@@ -49,6 +49,22 @@ safe_malloc(size_t size)
|
||||
return (data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility function to guarantee realloc() success.
|
||||
*/
|
||||
void *
|
||||
safe_realloc(void *from, size_t size)
|
||||
{
|
||||
void *data;
|
||||
|
||||
if ((data = realloc(from, size)) == NULL) {
|
||||
(void) fprintf(stderr, "internal error: out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return (data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display an out of memory error message and abort the current program.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user