Fix potential memory leaks found by the Clang static analyzer.
This commit is contained in:
		
							parent
							
								
									49edf9c53a
								
							
						
					
					
						commit
						b9b0defaf4
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -2521,6 +2521,7 @@ static int cmd_verify(int argc, char *argv[]) {
 | 
			
		|||
	char *newline = memchr(data, '\n', len);
 | 
			
		||||
	if(!newline || (newline - data > MAX_STRING_SIZE - 1)) {
 | 
			
		||||
		fprintf(stderr, "Invalid input\n");
 | 
			
		||||
		free(data);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2533,11 +2534,13 @@ static int cmd_verify(int argc, char *argv[]) {
 | 
			
		|||
 | 
			
		||||
	if(sscanf(data, "Signature = %s %ld %s", signer, &t, sig) != 3 || strlen(sig) != 86 || !t || !check_id(signer)) {
 | 
			
		||||
		fprintf(stderr, "Invalid input\n");
 | 
			
		||||
		free(data);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(node && strcmp(node, signer)) {
 | 
			
		||||
		fprintf(stderr, "Signature is not made by %s\n", node);
 | 
			
		||||
		free(data);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2831,8 +2834,10 @@ static int cmd_shell(int argc, char *argv[]) {
 | 
			
		|||
		if(nargc == argc)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if(!strcasecmp(nargv[argc], "exit") || !strcasecmp(nargv[argc], "quit"))
 | 
			
		||||
		if(!strcasecmp(nargv[argc], "exit") || !strcasecmp(nargv[argc], "quit")) {
 | 
			
		||||
			free(nargv);
 | 
			
		||||
			return result;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bool found = false;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue