[PATCH 0/1] MR2985: localspl: Fix memory leak in lpr_start_doc (scan-build).
From: Alex Henrie <alexhenrie24(a)gmail.com> --- 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 -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2985
This merge request was approved by Huw Davies. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2985
participants (3)
-
Alex Henrie -
Alex Henrie (@alexhenrie) -
Huw Davies (@huw)