net/openmdns: fix daemon memory leaks in various expected paths.

PR:	249296
This commit is contained in:
Alexey Dokuchaev 2021-07-13 10:19:12 +00:00
parent caaa5b3265
commit b275a10c2b
2 changed files with 31 additions and 1 deletions

View file

@ -1,6 +1,6 @@
PORTNAME= openmdns
DISTVERSION= 0.7
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= net
MAINTAINER= ports@FreeBSD.org

View file

@ -10,3 +10,33 @@
/*
* RR cache
*/
@@ -155,8 +158,10 @@ cache_process(struct rr *rr)
/* TODO Cancel possible deletion */
log_warnx("cache_process: recover %s",
rrs_str(&rr->rrs));
+ free(rr);
return (0);
}
+ free(rr);
return (0);
}
/*
@@ -186,14 +191,17 @@ cache_process(struct rr *rr)
rr_aux->ttl = rr->ttl;
rr_aux->revision = 0;
cache_schedrev(rr_aux);
+ free(rr);
return (0);
}
}
}
/* Got a goodbye for a record we don't have */
- if (rr->ttl == 0)
+ if (rr->ttl == 0) {
+ free(rr);
return (0);
+ }
return (cache_insert(rr));
}