mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	libzfs: zpool_load_compat(): don't free undefined pointers
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #11993
This commit is contained in:
		
							parent
							
								
									133fd00930
								
							
						
					
					
						commit
						12ed5275d1
					
				| @ -306,9 +306,10 @@ dm_get_underlying_path(const char *dm_name) | |||||||
| 	else | 	else | ||||||
| 		dev_str = tmp; | 		dev_str = tmp; | ||||||
| 
 | 
 | ||||||
| 	size = asprintf(&tmp, "/sys/block/%s/slaves/", dev_str); | 	if ((size = asprintf(&tmp, "/sys/block/%s/slaves/", dev_str)) == -1) { | ||||||
| 	if (size == -1 || !tmp) | 		tmp = NULL; | ||||||
| 		goto end; | 		goto end; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	dp = opendir(tmp); | 	dp = opendir(tmp); | ||||||
| 	if (dp == NULL) | 	if (dp == NULL) | ||||||
| @ -334,7 +335,9 @@ dm_get_underlying_path(const char *dm_name) | |||||||
| 			if (!enclosure_path) | 			if (!enclosure_path) | ||||||
| 				continue; | 				continue; | ||||||
| 
 | 
 | ||||||
| 			size = asprintf(&path, "/dev/%s", ep->d_name); | 			if ((size = asprintf( | ||||||
|  | 			    &path, "/dev/%s", ep->d_name)) == -1) | ||||||
|  | 				path = NULL; | ||||||
| 			free(enclosure_path); | 			free(enclosure_path); | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| @ -352,7 +355,8 @@ end: | |||||||
| 		 * enclosure devices.  Throw up out hands and return the first | 		 * enclosure devices.  Throw up out hands and return the first | ||||||
| 		 * underlying path. | 		 * underlying path. | ||||||
| 		 */ | 		 */ | ||||||
| 		size = asprintf(&path, "/dev/%s", first_path); | 		if ((size = asprintf(&path, "/dev/%s", first_path)) == -1) | ||||||
|  | 			path = NULL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	free(first_path); | 	free(first_path); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 наб
						наб