cups/0001-Fix-memory-leak-Issue-49.patch
2020-11-25 12:04:02 +01:00

44 lines
1.2 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

diff --git a/cups/http-support.c b/cups/http-support.c
index 6317514..ea8640c 100644
--- a/cups/http-support.c
+++ b/cups/http-support.c
@@ -1,8 +1,9 @@
/*
* HTTP support routines for CUPS.
*
- * Copyright 2007-2019 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright © 2020 by Michael R Sweet
+ * Copyright © 2007-2019 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
@@ -26,6 +27,8 @@
#elif defined(HAVE_AVAHI)
# include <avahi-client/client.h>
# include <avahi-client/lookup.h>
+// for avahi_free()
+# include <avahi-common/malloc.h>
# include <avahi-common/simple-watch.h>
#endif /* HAVE_DNSSD */
@@ -2536,6 +2539,8 @@ http_resolve_cb(
memcpy(uuid, value, valueLen);
uuid[valueLen] = '\0';
+ avahi_free(value);
+
if (_cups_strcasecmp(uuid, uribuf->uuid))
{
if (uribuf->options & _HTTP_RESOLVE_STDERR)
@@ -2620,6 +2625,8 @@ http_resolve_cb(
memcpy(resource + 1, value, valueLen);
resource[valueLen + 1] = '\0';
}
+
+ avahi_free(value);
}
else
{