diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-08-12 18:44:25 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-08-12 18:44:25 -0400 |
commit | 62192cba6e77d1568fc67e169caef8d394d097ff (patch) | |
tree | f60721dd58dfd3fa188f2cc94853e0f37d829ffa /modules | |
parent | 586826d34c7e53038b7b82bd7ab56ae8fb56afd4 (diff) | |
download | gtk+-62192cba6e77d1568fc67e169caef8d394d097ff.tar.gz |
cups printbackend: Plug memory leaks
This loop has many early exits, and all of them
need to free this info object that gets allocated
at the beginning.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/printbackends/gtkprintbackendcups.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/printbackends/gtkprintbackendcups.c b/modules/printbackends/gtkprintbackendcups.c index 00ffc00f73..9a713da0e4 100644 --- a/modules/printbackends/gtkprintbackendcups.c +++ b/modules/printbackends/gtkprintbackendcups.c @@ -3726,7 +3726,10 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, attr = ippNextAttribute (response); if (attr == NULL) - break; + { + printer_setup_info_free (info); + break; + } while (attr != NULL && ippGetGroupTag (attr) == IPP_TAG_PRINTER) { @@ -3737,6 +3740,7 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, if (info->printer_name == NULL || (info->printer_uri == NULL && info->member_uris == NULL)) { + printer_setup_info_free (info); if (attr == NULL) break; else @@ -3747,7 +3751,10 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, iter = g_list_find_custom (GTK_PRINT_BACKEND_CUPS (backend)->temporary_queues_removed, info->printer_name, (GCompareFunc) g_strcmp0); if (iter != NULL) - continue; + { + printer_setup_info_free (info); + continue; + } if (info->got_printer_type) { |