cups-browsed/0001-Fix-memory-leak-in-resolve_callback.patch

39 lines
1.1 KiB
Diff

From a38ab5522964afe07415aeebecdc12b13d0c9196 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Thu, 25 Jan 2024 17:43:25 +0100
Subject: [PATCH] Fix memory leak in resolve_callback
---
daemon/cups-browsed.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c
index 1e461bd1..d4527c05 100644
--- a/daemon/cups-browsed.c
+++ b/daemon/cups-browsed.c
@@ -10899,7 +10899,7 @@ resolve_callback(void* arg)
AVAHI_GCC_UNUSED void* userdata = a->userdata;
char ifname[IF_NAMESIZE];
- AvahiStringList *uuid_entry, *printer_type_entry;
+ AvahiStringList *uuid_entry = NULL, *printer_type_entry;
char *uuid_key, *uuid_value;
debug_printf("resolve_callback() in THREAD %ld\n", pthread_self());
@@ -11176,6 +11176,12 @@ resolve_callback(void* arg)
}
ignore:
+ if (uuid_entry)
+ {
+ avahi_free(uuid_key);
+ avahi_free(uuid_value);
+ }
+
if (a->name) free((char*)a->name);
if (a->type) free((char*)a->type);
if (a->domain) free((char*)a->domain);
--
2.43.0