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
1df98a99
Commit
1df98a99
authored
Nov 02, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jsproxy: Use CRT allocation functions.
parent
9f3a275d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
main.c
dlls/jsproxy/main.c
+13
-14
No files found.
dlls/jsproxy/main.c
View file @
1df98a99
...
...
@@ -31,7 +31,6 @@
#include "dispex.h"
#include "activscp.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
jsproxy
);
...
...
@@ -50,7 +49,7 @@ static inline WCHAR *strdupAW( const char *src, int len )
if
(
src
)
{
int
dst_len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
len
,
NULL
,
0
);
if
((
dst
=
heap_
alloc
(
(
dst_len
+
1
)
*
sizeof
(
WCHAR
)
)))
if
((
dst
=
m
alloc
(
(
dst_len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
len
,
dst
,
dst_len
);
dst
[
dst_len
]
=
0
;
...
...
@@ -65,7 +64,7 @@ static inline char *strdupWA( const WCHAR *src )
if
(
src
)
{
int
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
src
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
((
dst
=
heap_
alloc
(
len
)))
WideCharToMultiByte
(
CP_ACP
,
0
,
src
,
-
1
,
dst
,
len
,
NULL
,
NULL
);
if
((
dst
=
m
alloc
(
len
)))
WideCharToMultiByte
(
CP_ACP
,
0
,
src
,
-
1
,
dst
,
len
,
NULL
,
NULL
);
}
return
dst
;
}
...
...
@@ -85,7 +84,7 @@ BOOL WINAPI InternetDeInitializeAutoProxyDll( LPSTR mime, DWORD reserved )
EnterCriticalSection
(
&
cs_jsproxy
);
heap_
free
(
global_script
->
text
);
free
(
global_script
->
text
);
global_script
->
text
=
NULL
;
LeaveCriticalSection
(
&
cs_jsproxy
);
...
...
@@ -104,17 +103,17 @@ static WCHAR *load_script( const char *filename )
if
(
handle
==
INVALID_HANDLE_VALUE
)
return
NULL
;
size
=
GetFileSize
(
handle
,
NULL
);
if
(
!
(
buffer
=
heap_
alloc
(
size
)))
goto
done
;
if
(
!
(
buffer
=
m
alloc
(
size
)))
goto
done
;
if
(
!
ReadFile
(
handle
,
buffer
,
size
,
&
bytes_read
,
NULL
)
||
bytes_read
!=
size
)
goto
done
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
buffer
,
size
,
NULL
,
0
);
if
(
!
(
script
=
heap_
alloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
goto
done
;
if
(
!
(
script
=
m
alloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
buffer
,
size
,
script
,
len
);
script
[
len
]
=
0
;
done:
CloseHandle
(
handle
);
heap_
free
(
buffer
);
free
(
buffer
);
return
script
;
}
...
...
@@ -141,13 +140,13 @@ BOOL WINAPI JSPROXY_InternetInitializeAutoProxyDll( DWORD version, LPSTR tmpfile
LeaveCriticalSection
(
&
cs_jsproxy
);
return
FALSE
;
}
heap_
free
(
global_script
->
text
);
free
(
global_script
->
text
);
if
((
global_script
->
text
=
strdupAW
(
buffer
->
lpszScriptBuffer
,
buffer
->
dwScriptBufferSize
)))
ret
=
TRUE
;
}
else
{
heap_
free
(
global_script
->
text
);
free
(
global_script
->
text
);
if
((
global_script
->
text
=
load_script
(
tmpfile
)))
ret
=
TRUE
;
}
...
...
@@ -263,10 +262,10 @@ static char *get_computer_name( COMPUTER_NAME_FORMAT format )
GetComputerNameExA
(
format
,
NULL
,
&
size
);
if
(
GetLastError
()
!=
ERROR_MORE_DATA
)
return
NULL
;
if
(
!
(
ret
=
heap_
alloc
(
size
)))
return
NULL
;
if
(
!
(
ret
=
m
alloc
(
size
)))
return
NULL
;
if
(
!
GetComputerNameExA
(
format
,
ret
,
&
size
))
{
heap_
free
(
ret
);
free
(
ret
);
return
NULL
;
}
return
ret
;
...
...
@@ -295,7 +294,7 @@ static HRESULT dns_resolve( const WCHAR *hostname, VARIANT *result )
if
(
!
hostnameA
)
return
E_OUTOFMEMORY
;
res
=
getaddrinfo
(
hostnameA
,
NULL
,
NULL
,
&
ai
);
heap_
free
(
hostnameA
);
free
(
hostnameA
);
if
(
res
)
return
S_FALSE
;
elem
=
ai
;
...
...
@@ -589,8 +588,8 @@ BOOL WINAPI InternetGetProxyInfo( LPCSTR url, DWORD len_url, LPCSTR hostname, DW
ret
=
run_script
(
global_script
->
text
,
urlW
,
hostnameW
,
proxy
,
len_proxy
);
done:
heap_
free
(
hostnameW
);
heap_
free
(
urlW
);
free
(
hostnameW
);
free
(
urlW
);
LeaveCriticalSection
(
&
cs_jsproxy
);
return
ret
;
}
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