Commit Diff
Diff:
c7c8ef448bc8832998606ec217907c7dc66fec6c
3c4b712bb2ef520be964da95fd627060f6639bf8
Commit:
3c4b712bb2ef520be964da95fd627060f6639bf8
Tree:
98f2a99433176188f91be64b215551a95d3f2c7f
Author:
Omar Polo <op@omarpolo.com>
Date:
Sat Jan 1 19:10:00 2022 UTC
Message:
plug some memory leaks in config parsing

I forgot to free some strings when they're no more used.
commit - c7c8ef448bc8832998606ec217907c7dc66fec6c
commit + 3c4b712bb2ef520be964da95fd627060f6639bf8
blob - 6359227df8680bb34dbb84cb46eab049ebf2b502
blob + 14af60db6c5ae9dac706d9a9e20b9a54b3d4df85
--- parse.y
+++ parse.y
@@ -209,6 +209,7 @@ option : CHROOT string { conf.chroot = $2; }
| PROTOCOLS string {
if (tls_config_parse_protocols(&conf.protos, $2) == -1)
yyerror("invalid protocols string \"%s\"", $2);
+ free($2);
}
| USER string { conf.user = $2; }
;
@@ -299,6 +300,7 @@ proxy_opt : CERT string {
p->cert = tls_load_file($2, &p->certlen, NULL);
if (p->cert == NULL)
yyerror("can't load cert %s", $2);
+ free($2);
}
| KEY string {
struct proxy *p = &host->proxy;
@@ -308,12 +310,14 @@ proxy_opt : CERT string {
p->key = tls_load_file($2, &p->keylen, NULL);
if (p->key == NULL)
yyerror("can't load key %s", $2);
+ free($2);
}
| PROTOCOLS string {
struct proxy *p = &host->proxy;
if (tls_config_parse_protocols(&p->protocols, $2) == -1)
yyerror("invalid protocols string \"%s\"", $2);
+ free($2);
}
| RELAY_TO string {
char *at;
Omar Polo