Alex Henrie : localspl: Fix memory leak in lpr_start_doc (scan-build).
Module: wine Branch: master Commit: 78ef7c3461f9930a7fe0c3c7aebc956f20ce942e URL: https://gitlab.winehq.org/wine/wine/-/commit/78ef7c3461f9930a7fe0c3c7aebc956... Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Jun 6 00:06:07 2023 -0600 localspl: Fix memory leak in lpr_start_doc (scan-build). --- dlls/localspl/cups.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/localspl/cups.c b/dlls/localspl/cups.c index 8ef25c71157..a7f2273aba1 100644 --- a/dlls/localspl/cups.c +++ b/dlls/localspl/cups.c @@ -219,12 +219,15 @@ static BOOL lpr_start_doc(doc_t *doc, const WCHAR *printer_name) static const WCHAR quote[] = { '\'',0 }; int printer_len = wcslen(printer_name); WCHAR *cmd; + BOOL ret; cmd = malloc(printer_len * sizeof(WCHAR) + sizeof(lpr) + sizeof(quote)); memcpy(cmd, lpr, sizeof(lpr)); memcpy(cmd + ARRAY_SIZE(lpr), printer_name, printer_len * sizeof(WCHAR)); memcpy(cmd + ARRAY_SIZE(lpr) + printer_len, quote, sizeof(quote)); - return pipe_start_doc(doc, cmd); + ret = pipe_start_doc(doc, cmd); + free(cmd); + return ret; } #ifdef SONAME_LIBCUPS
participants (1)
-
Alexandre Julliard