From dd68d665e140970c7d9dfd899fbdd4fefacb54a7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 30 Jun 2018 12:01:27 +0200 Subject: [PATCH] fix memory leak --- src/namestore/gnunet-zoneimport.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c index 6c89cdb05..ddc8b483a 100644 --- a/src/namestore/gnunet-zoneimport.c +++ b/src/namestore/gnunet-zoneimport.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -456,6 +456,7 @@ build_dns_query (struct Request *req, char *rawp; struct GNUNET_DNSPARSER_Packet p; struct GNUNET_DNSPARSER_Query q; + int ret; q.name = (char *) req->hostname; q.type = GNUNET_DNSPARSER_TYPE_NS; @@ -467,12 +468,14 @@ build_dns_query (struct Request *req, p.num_queries = 1; p.queries = &q; p.id = req->id; - if (GNUNET_OK != - GNUNET_DNSPARSER_pack (&p, - UINT16_MAX, - &rawp, - raw_size)) + ret = GNUNET_DNSPARSER_pack (&p, + UINT16_MAX, + &rawp, + raw_size); + if (GNUNET_OK != ret) { + if (GNUNET_NO == ret) + GNUNET_free (rawp); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to pack query for hostname `%s'\n", req->hostname); -- 2.25.1