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
614b881b
Commit
614b881b
authored
Nov 15, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpapi: Use standard C functions for memory allocation.
parent
0587b717
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
21 deletions
+12
-21
httpapi_main.c
dlls/httpapi/httpapi_main.c
+12
-21
No files found.
dlls/httpapi/httpapi_main.c
View file @
614b881b
...
...
@@ -22,19 +22,10 @@
#include "winsvc.h"
#include "winternl.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
http
);
static
WCHAR
*
heap_strdupW
(
const
WCHAR
*
str
)
{
int
len
=
wcslen
(
str
)
+
1
;
WCHAR
*
ret
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
wcscpy
(
ret
,
str
);
return
ret
;
}
/***********************************************************************
* HttpInitialize (HTTPAPI.@)
*
...
...
@@ -216,7 +207,7 @@ static ULONG add_url(HANDLE queue, const WCHAR *urlW, HTTP_URL_CONTEXT context)
int
len
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
urlW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
(
params
=
heap_
alloc
(
offsetof
(
struct
http_add_url_params
,
url
[
len
]))))
if
(
!
(
params
=
m
alloc
(
offsetof
(
struct
http_add_url_params
,
url
[
len
]))))
return
ERROR_OUTOFMEMORY
;
WideCharToMultiByte
(
CP_ACP
,
0
,
urlW
,
-
1
,
params
->
url
,
len
,
NULL
,
NULL
);
params
->
context
=
context
;
...
...
@@ -227,7 +218,7 @@ static ULONG add_url(HANDLE queue, const WCHAR *urlW, HTTP_URL_CONTEXT context)
offsetof
(
struct
http_add_url_params
,
url
[
len
]),
NULL
,
0
,
NULL
,
&
ovl
))
ret
=
GetLastError
();
CloseHandle
(
ovl
.
hEvent
);
heap_
free
(
params
);
free
(
params
);
return
ret
;
}
...
...
@@ -249,7 +240,7 @@ static ULONG remove_url(HANDLE queue, const WCHAR *urlW)
int
len
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
urlW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
(
url
=
heap_
alloc
(
len
)))
if
(
!
(
url
=
m
alloc
(
len
)))
return
ERROR_OUTOFMEMORY
;
WideCharToMultiByte
(
CP_ACP
,
0
,
urlW
,
-
1
,
url
,
len
,
NULL
,
NULL
);
...
...
@@ -258,7 +249,7 @@ static ULONG remove_url(HANDLE queue, const WCHAR *urlW)
if
(
!
DeviceIoControl
(
queue
,
IOCTL_HTTP_REMOVE_URL
,
url
,
len
,
NULL
,
0
,
NULL
,
&
ovl
))
ret
=
GetLastError
();
CloseHandle
(
ovl
.
hEvent
);
heap_
free
(
url
);
free
(
url
);
return
ret
;
}
...
...
@@ -470,7 +461,7 @@ ULONG WINAPI HttpSendHttpResponse(HANDLE queue, HTTP_REQUEST_ID id, ULONG flags,
}
len
+=
2
;
if
(
!
(
buffer
=
heap_
alloc
(
offsetof
(
struct
http_response
,
buffer
[
len
]))))
if
(
!
(
buffer
=
m
alloc
(
offsetof
(
struct
http_response
,
buffer
[
len
]))))
return
ERROR_OUTOFMEMORY
;
buffer
->
id
=
id
;
buffer
->
len
=
len
;
...
...
@@ -512,7 +503,7 @@ ULONG WINAPI HttpSendHttpResponse(HANDLE queue, HTTP_REQUEST_ID id, ULONG flags,
offsetof
(
struct
http_response
,
buffer
[
len
]),
NULL
,
0
,
NULL
,
ovl
))
ret
=
GetLastError
();
heap_
free
(
buffer
);
free
(
buffer
);
return
ret
;
}
...
...
@@ -573,7 +564,7 @@ ULONG WINAPI HttpCreateServerSession(HTTPAPI_VERSION version, HTTP_SERVER_SESSIO
||
version
.
HttpApiMinorVersion
)
return
ERROR_REVISION_MISMATCH
;
if
(
!
(
session
=
heap_
alloc
(
sizeof
(
*
session
))))
if
(
!
(
session
=
m
alloc
(
sizeof
(
*
session
))))
return
ERROR_OUTOFMEMORY
;
list_add_tail
(
&
server_sessions
,
&
session
->
entry
);
...
...
@@ -601,7 +592,7 @@ ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID id)
HttpCloseUrlGroup
((
ULONG_PTR
)
group
);
}
list_remove
(
&
session
->
entry
);
heap_
free
(
session
);
free
(
session
);
return
ERROR_SUCCESS
;
}
...
...
@@ -619,7 +610,7 @@ ULONG WINAPI HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID session_id, HTTP_URL_GROU
if
(
!
(
session
=
get_server_session
(
session_id
)))
return
ERROR_INVALID_PARAMETER
;
if
(
!
(
group
=
heap_alloc_zero
(
sizeof
(
*
group
))))
if
(
!
(
group
=
calloc
(
1
,
sizeof
(
*
group
))))
return
ERROR_OUTOFMEMORY
;
list_add_tail
(
&
url_groups
,
&
group
->
entry
);
list_add_tail
(
&
session
->
groups
,
&
group
->
session_entry
);
...
...
@@ -643,7 +634,7 @@ ULONG WINAPI HttpCloseUrlGroup(HTTP_URL_GROUP_ID id)
list_remove
(
&
group
->
session_entry
);
list_remove
(
&
group
->
entry
);
heap_
free
(
group
);
free
(
group
);
return
ERROR_SUCCESS
;
}
...
...
@@ -704,7 +695,7 @@ ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url,
return
ret
;
}
if
(
!
(
group
->
url
=
heap_strdupW
(
url
)))
if
(
!
(
group
->
url
=
wcsdup
(
url
)))
return
ERROR_OUTOFMEMORY
;
group
->
context
=
context
;
...
...
@@ -726,7 +717,7 @@ ULONG WINAPI HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, U
if
(
flags
)
FIXME
(
"Ignoring flags %#lx.
\n
"
,
flags
);
heap_
free
(
group
->
url
);
free
(
group
->
url
);
group
->
url
=
NULL
;
if
(
group
->
queue
)
...
...
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