mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-29 03:45:02 +01:00
libzfs: Do not call munmap() when mmap() fails
Reported-by: Grok 4.5 Build Beta Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Rob Norris <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #18869
This commit is contained in:
1 parent
b5bb1f8161
commit
be62c53850
1 file changed
+3
-2
@@ -5534,9 +5534,10 @@ zpool_load_compat(const char *compat, boolean_t *features, char *report,
|
||||
ZC_MMAP_FLAGS, featfd, 0);
|
||||
(void) close(featfd);
|
||||
|
||||
/* map ok, and last character == newline? */
|
||||
/* need map ok, and last character == newline */
|
||||
if (fc == MAP_FAILED || fc[fs.st_size - 1] != '\n') {
|
||||
(void) munmap((void *) fc, fs.st_size);
|
||||
if (fc != MAP_FAILED)
|
||||
(void) munmap((void *) fc, fs.st_size);
|
||||
strlcat(err_badfile, file, ZFS_MAXPROPLEN);
|
||||
strlcat(err_badfile, " ", ZFS_MAXPROPLEN);
|
||||
ret_badfile = B_TRUE;
|
||||
|
||||
Reference in new issue
Block a user