mirror of
				https://git.code.sf.net/p/linux-ima/ima-evm-utils
				synced 2025-10-30 20:52:15 +01:00 
			
		
		
		
	evmctl: fix memory leak in get_password
The variable "password" is not freed nor returned in case get_password()
succeeds. Return it instead of the intermediary variable "pwd". Issue found
by Coverity scan tool.
src/evmctl.c:2565: leaked_storage: Variable "password" going out of scope
    leaks the storage it points to.
Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
			
			
This commit is contained in:
		 Bruno Meneguele
					Bruno Meneguele
				
			
				
					committed by
					
						 Mimi Zohar
						Mimi Zohar
					
				
			
			
				
	
			
			
			 Mimi Zohar
						Mimi Zohar
					
				
			
						parent
						
							b1818c1113
						
					
				
				
					commit
					fa2ba9a6e9
				
			| @@ -2629,7 +2629,12 @@ static char *get_password(void) | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	return pwd; | ||||
| 	if (pwd == NULL) { | ||||
| 		free(password); | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	return password; | ||||
| } | ||||
|  | ||||
| int main(int argc, char *argv[]) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user