wmbiff: fixed leaks.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:
		
							parent
							
								
									e672c84d1c
								
							
						
					
					
						commit
						de97a44cb4
					
				
					 5 changed files with 12 additions and 4 deletions
				
			
		| 
						 | 
					@ -200,6 +200,7 @@ FILE *imap_open(Pop3 *pc)
 | 
				
			||||||
			   mailboxes more often while remote things are
 | 
								   mailboxes more often while remote things are
 | 
				
			||||||
			   unavailable or disconnected.  */
 | 
								   unavailable or disconnected.  */
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							free(connection_name);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -463,6 +464,7 @@ void imap_cacheHeaders( /*@notnull@ */ Pop3 *pc)
 | 
				
			||||||
				pc->headerCache = m;
 | 
									pc->headerCache = m;
 | 
				
			||||||
				pc->headerCache->in_use = 0;	/* initialize that it isn't locked */
 | 
									pc->headerCache->in_use = 0;	/* initialize that it isn't locked */
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
 | 
									free(m);
 | 
				
			||||||
				IMAP_DM(pc, DEBUG_ERROR, "error fetching: %s", hdrbuf);
 | 
									IMAP_DM(pc, DEBUG_ERROR, "error fetching: %s", hdrbuf);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (!fetch_command_done) {
 | 
								if (!fetch_command_done) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -213,6 +213,7 @@ char *passwordFor(const char *username, const char *servername, Pop3 *pc,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	password_binding *p;
 | 
						password_binding *p;
 | 
				
			||||||
 | 
						int p_allocked = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert(username != NULL);
 | 
						assert(username != NULL);
 | 
				
			||||||
	assert(username[0] != '\0');
 | 
						assert(username[0] != '\0');
 | 
				
			||||||
| 
						 | 
					@ -241,6 +242,7 @@ char *passwordFor(const char *username, const char *servername, Pop3 *pc,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		p = malloc(sizeof *p);
 | 
							p = malloc(sizeof *p);
 | 
				
			||||||
 | 
							p_allocked = 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* else, try to get it. */
 | 
						/* else, try to get it. */
 | 
				
			||||||
| 
						 | 
					@ -282,6 +284,9 @@ char *passwordFor(const char *username, const char *servername, Pop3 *pc,
 | 
				
			||||||
		return (retval);
 | 
							return (retval);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (p_allocked) {
 | 
				
			||||||
 | 
							free(p);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return (NULL);
 | 
						return (NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -106,6 +106,7 @@ main(int argc __attribute__ ((unused)), char **argv
 | 
				
			||||||
		memset(scs.unprocessed, 0, BUF_SIZE);
 | 
							memset(scs.unprocessed, 0, BUF_SIZE);
 | 
				
			||||||
		printf("%d\n", tlscomm_expect(&scs, "prefix", buf, 255));
 | 
							printf("%d\n", tlscomm_expect(&scs, "prefix", buf, 255));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						free(scs.name);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -386,9 +386,9 @@ static int tls_compare_certificates(const gnutls_datum_t * peercert)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fd1 = fopen(certificate_filename, "r");
 | 
						fd1 = fopen(certificate_filename, "r");
 | 
				
			||||||
	if (fd1 == NULL) {
 | 
						if (fd1 == NULL) {
 | 
				
			||||||
 | 
							free(b64_data_data);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	b64_data.size = fread(b64_data.data, 1, b64_data.size, fd1);
 | 
						b64_data.size = fread(b64_data.data, 1, b64_data.size, fd1);
 | 
				
			||||||
	fclose(fd1);
 | 
						fclose(fd1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -119,8 +119,8 @@ void parse_rcfile(const char *filename, rckeys * keys)
 | 
				
			||||||
	if (fp) {
 | 
						if (fp) {
 | 
				
			||||||
		while (fgets(temp, 128, fp)) {
 | 
							while (fgets(temp, 128, fp)) {
 | 
				
			||||||
			key = 0;
 | 
								key = 0;
 | 
				
			||||||
			q = strdup(temp);
 | 
								char *t = strdup(temp);
 | 
				
			||||||
			q = strtok(q, tokens);
 | 
								q = strtok(t, tokens);
 | 
				
			||||||
			while (key >= 0 && keys[key].label) {
 | 
								while (key >= 0 && keys[key].label) {
 | 
				
			||||||
				if ((!strcmp(q, keys[key].label))) {
 | 
									if ((!strcmp(q, keys[key].label))) {
 | 
				
			||||||
					p = strstr(temp, keys[key].label);
 | 
										p = strstr(temp, keys[key].label);
 | 
				
			||||||
| 
						 | 
					@ -134,7 +134,7 @@ void parse_rcfile(const char *filename, rckeys * keys)
 | 
				
			||||||
				} else
 | 
									} else
 | 
				
			||||||
					key++;
 | 
										key++;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			free(q);
 | 
								free(t);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		fclose(fp);
 | 
							fclose(fp);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue