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
01dae001
Commit
01dae001
authored
Nov 17, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spoolss: Use standard C functions for memory allocation in router.c.
parent
6a5dcc52
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
32 deletions
+13
-32
router.c
dlls/spoolss/router.c
+13
-32
No files found.
dlls/spoolss/router.c
View file @
01dae001
...
...
@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
...
...
@@ -31,7 +32,6 @@
#include "spoolss.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
spoolss
);
...
...
@@ -154,25 +154,6 @@ static CRITICAL_SECTION backend_cs = { &backend_cs_debug, -1, 0, 0, 0, 0 };
static
WCHAR
localsplW
[]
=
L"localspl.dll"
;
/******************************************************************
* strdupW [internal]
*
* create a copy of a unicode-string
*
*/
static
LPWSTR
strdupW
(
LPCWSTR
p
)
{
LPWSTR
ret
;
DWORD
len
;
if
(
!
p
)
return
NULL
;
len
=
(
lstrlenW
(
p
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
heap_alloc
(
len
);
memcpy
(
ret
,
p
,
len
);
return
ret
;
}
/******************************************************************
* backend_unload_all [internal]
*
* unload all backends
...
...
@@ -183,10 +164,10 @@ void backend_unload_all(void)
while
(
used_backends
>
0
)
{
used_backends
--
;
FreeLibrary
(
backend
[
used_backends
]
->
dll
);
heap_
free
(
backend
[
used_backends
]
->
dllname
);
heap_
free
(
backend
[
used_backends
]
->
name
);
heap_
free
(
backend
[
used_backends
]
->
regroot
);
heap_
free
(
backend
[
used_backends
]);
free
(
backend
[
used_backends
]
->
dllname
);
free
(
backend
[
used_backends
]
->
name
);
free
(
backend
[
used_backends
]
->
regroot
);
free
(
backend
[
used_backends
]);
backend
[
used_backends
]
=
NULL
;
}
LeaveCriticalSection
(
&
backend_cs
);
...
...
@@ -217,15 +198,15 @@ static backend_t * backend_load(LPWSTR dllname, LPWSTR name, LPWSTR regroot)
EnterCriticalSection
(
&
backend_cs
);
id
=
used_backends
;
backend
[
id
]
=
heap_alloc_zero
(
sizeof
(
backend_t
));
backend
[
id
]
=
calloc
(
1
,
sizeof
(
backend_t
));
if
(
!
backend
[
id
])
{
LeaveCriticalSection
(
&
backend_cs
);
return
NULL
;
}
backend
[
id
]
->
dllname
=
strdupW
(
dllname
);
backend
[
id
]
->
name
=
strdupW
(
name
);
backend
[
id
]
->
regroot
=
strdupW
(
regroot
);
backend
[
id
]
->
dllname
=
wcsdup
(
dllname
);
backend
[
id
]
->
name
=
wcsdup
(
name
);
backend
[
id
]
->
regroot
=
wcsdup
(
regroot
);
backend
[
id
]
->
dll
=
LoadLibraryW
(
dllname
);
if
(
backend
[
id
]
->
dll
)
{
...
...
@@ -244,10 +225,10 @@ static backend_t * backend_load(LPWSTR dllname, LPWSTR name, LPWSTR regroot)
}
FreeLibrary
(
backend
[
id
]
->
dll
);
}
heap_
free
(
backend
[
id
]
->
dllname
);
heap_
free
(
backend
[
id
]
->
name
);
heap_
free
(
backend
[
id
]
->
regroot
);
heap_
free
(
backend
[
id
]);
free
(
backend
[
id
]
->
dllname
);
free
(
backend
[
id
]
->
name
);
free
(
backend
[
id
]
->
regroot
);
free
(
backend
[
id
]);
backend
[
id
]
=
NULL
;
LeaveCriticalSection
(
&
backend_cs
);
WARN
(
"failed to init %s: %lu
\n
"
,
debugstr_w
(
dllname
),
GetLastError
());
...
...
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