Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5d47a691
Commit
5d47a691
authored
Apr 24, 2012
by
Huw Davies
Committed by
Alexandre Julliard
Apr 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool: Don't leak the handle returned by AddPrinter.
parent
9674011d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
info.c
dlls/winspool.drv/info.c
+12
-10
No files found.
dlls/winspool.drv/info.c
View file @
5d47a691
...
@@ -494,6 +494,7 @@ static BOOL CUPS_LoadPrinters(void)
...
@@ -494,6 +494,7 @@ static BOOL CUPS_LoadPrinters(void)
HKEY
hkeyPrinter
,
hkeyPrinters
;
HKEY
hkeyPrinter
,
hkeyPrinters
;
char
loaderror
[
256
];
char
loaderror
[
256
];
WCHAR
nameW
[
MAX_PATH
];
WCHAR
nameW
[
MAX_PATH
];
HANDLE
added_printer
;
cupshandle
=
wine_dlopen
(
SONAME_LIBCUPS
,
RTLD_NOW
,
loaderror
,
sizeof
(
loaderror
));
cupshandle
=
wine_dlopen
(
SONAME_LIBCUPS
,
RTLD_NOW
,
loaderror
,
sizeof
(
loaderror
));
if
(
!
cupshandle
)
{
if
(
!
cupshandle
)
{
...
@@ -548,10 +549,10 @@ static BOOL CUPS_LoadPrinters(void)
...
@@ -548,10 +549,10 @@ static BOOL CUPS_LoadPrinters(void)
pi2
.
pShareName
=
emptyStringW
;
pi2
.
pShareName
=
emptyStringW
;
pi2
.
pSepFile
=
emptyStringW
;
pi2
.
pSepFile
=
emptyStringW
;
if
(
!
AddPrinterW
(
NULL
,
2
,
(
LPBYTE
)
&
pi2
))
{
added_printer
=
AddPrinterW
(
NULL
,
2
,
(
LPBYTE
)
&
pi2
);
if
(
GetLastError
()
!=
ERROR_PRINTER_ALREADY_EXISTS
)
if
(
added_printer
)
ClosePrinter
(
added_printer
);
ERR
(
"printer '%s' not added by AddPrinter (error %d)
\n
"
,
debugstr_w
(
nameW
),
GetLastError
());
else
if
(
GetLastError
()
!=
ERROR_PRINTER_ALREADY_EXISTS
)
}
ERR
(
"printer '%s' not added by AddPrinter (error %d)
\n
"
,
debugstr_w
(
nameW
),
GetLastError
()
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
port
);
HeapFree
(
GetProcessHeap
(),
0
,
port
);
...
@@ -571,8 +572,8 @@ static BOOL CUPS_LoadPrinters(void)
...
@@ -571,8 +572,8 @@ static BOOL CUPS_LoadPrinters(void)
}
}
#endif
#endif
static
BOOL
static
BOOL
PRINTCAP_ParseEntry
(
const
char
*
pent
,
BOOL
isfirst
)
PRINTCAP_ParseEntry
(
const
char
*
pent
,
BOOL
isfirst
)
{
{
PRINTER_INFO_2A
pinfo2a
;
PRINTER_INFO_2A
pinfo2a
;
const
char
*
r
;
const
char
*
r
;
size_t
name_len
;
size_t
name_len
;
...
@@ -581,6 +582,7 @@ PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) {
...
@@ -581,6 +582,7 @@ PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) {
char
*
port
=
NULL
,
*
env_default
;
char
*
port
=
NULL
,
*
env_default
;
HKEY
hkeyPrinter
,
hkeyPrinters
;
HKEY
hkeyPrinter
,
hkeyPrinters
;
WCHAR
devnameW
[
MAX_PATH
];
WCHAR
devnameW
[
MAX_PATH
];
HANDLE
added_printer
;
while
(
isspace
(
*
pent
))
pent
++
;
while
(
isspace
(
*
pent
))
pent
++
;
r
=
strchr
(
pent
,
':'
);
r
=
strchr
(
pent
,
':'
);
...
@@ -678,10 +680,10 @@ PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) {
...
@@ -678,10 +680,10 @@ PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) {
pinfo2a
.
pShareName
=
share_name
;
pinfo2a
.
pShareName
=
share_name
;
pinfo2a
.
pSepFile
=
sep_file
;
pinfo2a
.
pSepFile
=
sep_file
;
if
(
!
AddPrinterA
(
NULL
,
2
,(
LPBYTE
)
&
pinfo2a
))
{
added_printer
=
AddPrinterA
(
NULL
,
2
,
(
LPBYTE
)
&
pinfo2a
);
if
(
GetLastError
()
!=
ERROR_PRINTER_ALREADY_EXISTS
)
if
(
added_printer
)
ClosePrinter
(
added_printer
);
ERR
(
"%s not added by AddPrinterA (%d)
\n
"
,
name
,
GetLastError
());
else
if
(
GetLastError
()
!=
ERROR_PRINTER_ALREADY_EXISTS
)
}
ERR
(
"printer '%s' not added by AddPrinter (error %d)
\n
"
,
debugstr_a
(
name
),
GetLastError
()
);
}
}
RegCloseKey
(
hkeyPrinters
);
RegCloseKey
(
hkeyPrinters
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment