wmbiff: fixed leaks.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:
Jeremy Sowden 2019-07-02 20:53:44 +01:00 committed by Carlos R. Mafra
parent e672c84d1c
commit de97a44cb4
5 changed files with 12 additions and 4 deletions

View file

@ -200,6 +200,7 @@ FILE *imap_open(Pop3 *pc)
mailboxes more often while remote things are
unavailable or disconnected. */
}
free(connection_name);
return NULL;
}
@ -463,6 +464,7 @@ void imap_cacheHeaders( /*@notnull@ */ Pop3 *pc)
pc->headerCache = m;
pc->headerCache->in_use = 0; /* initialize that it isn't locked */
} else {
free(m);
IMAP_DM(pc, DEBUG_ERROR, "error fetching: %s", hdrbuf);
}
if (!fetch_command_done) {

View file

@ -213,6 +213,7 @@ char *passwordFor(const char *username, const char *servername, Pop3 *pc,
{
password_binding *p;
int p_allocked = 0;
assert(username != NULL);
assert(username[0] != '\0');
@ -241,6 +242,7 @@ char *passwordFor(const char *username, const char *servername, Pop3 *pc,
}
} else {
p = malloc(sizeof *p);
p_allocked = 1;
}
/* else, try to get it. */
@ -282,6 +284,9 @@ char *passwordFor(const char *username, const char *servername, Pop3 *pc,
return (retval);
}
if (p_allocked) {
free(p);
}
return (NULL);
}

View file

@ -106,6 +106,7 @@ main(int argc __attribute__ ((unused)), char **argv
memset(scs.unprocessed, 0, BUF_SIZE);
printf("%d\n", tlscomm_expect(&scs, "prefix", buf, 255));
}
free(scs.name);
return 0;
}

View file

@ -386,9 +386,9 @@ static int tls_compare_certificates(const gnutls_datum_t * peercert)
fd1 = fopen(certificate_filename, "r");
if (fd1 == NULL) {
free(b64_data_data);
return 0;
}
b64_data.size = fread(b64_data.data, 1, b64_data.size, fd1);
fclose(fd1);

View file

@ -119,8 +119,8 @@ void parse_rcfile(const char *filename, rckeys * keys)
if (fp) {
while (fgets(temp, 128, fp)) {
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
char *t = strdup(temp);
q = strtok(t, tokens);
while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) {
p = strstr(temp, keys[key].label);
@ -134,7 +134,7 @@ void parse_rcfile(const char *filename, rckeys * keys)
} else
key++;
}
free(q);
free(t);
}
fclose(fp);
}