Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
f6917bad
Commit
f6917bad
authored
Oct 01, 2021
by
Huw Davies
Committed by
Alexandre Julliard
Oct 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nsiproxy: Switch memory allocations to malloc().
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
280999ae
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
35 deletions
+31
-35
ip.c
dlls/nsiproxy.sys/ip.c
+6
-7
ndis.c
dlls/nsiproxy.sys/ndis.c
+5
-6
tcp.c
dlls/nsiproxy.sys/tcp.c
+16
-17
udp.c
dlls/nsiproxy.sys/udp.c
+4
-5
No files found.
dlls/nsiproxy.sys/ip.c
View file @
f6917bad
...
...
@@ -94,7 +94,6 @@
#include "ifdef.h"
#include "ipmib.h"
#include "netiodef.h"
#include "wine/heap.h"
#include "wine/nsi.h"
#include "wine/debug.h"
...
...
@@ -933,12 +932,12 @@ static NTSTATUS ipv4_neighbour_enumerate_all( void *key_data, DWORD key_size, vo
if
(
sysctl
(
mib
,
ARRAY_SIZE
(
mib
),
NULL
,
&
needed
,
NULL
,
0
)
==
-
1
)
return
STATUS_NOT_SUPPORTED
;
buf
=
heap_
alloc
(
needed
);
buf
=
m
alloc
(
needed
);
if
(
!
buf
)
return
STATUS_NO_MEMORY
;
if
(
sysctl
(
mib
,
ARRAY_SIZE
(
mib
),
buf
,
&
needed
,
NULL
,
0
)
==
-
1
)
{
heap_
free
(
buf
);
free
(
buf
);
return
STATUS_NOT_SUPPORTED
;
}
...
...
@@ -982,7 +981,7 @@ static NTSTATUS ipv4_neighbour_enumerate_all( void *key_data, DWORD key_size, vo
}
next
+=
rtm
->
rtm_msglen
;
}
heap_
free
(
buf
);
free
(
buf
);
}
#else
FIXME
(
"not implemented
\n
"
);
...
...
@@ -1122,12 +1121,12 @@ static NTSTATUS ipv4_forward_enumerate_all( void *key_data, DWORD key_size, void
if
(
sysctl
(
mib
,
ARRAY_SIZE
(
mib
),
NULL
,
&
needed
,
NULL
,
0
)
<
0
)
return
STATUS_NOT_SUPPORTED
;
buf
=
heap_
alloc
(
needed
);
buf
=
m
alloc
(
needed
);
if
(
!
buf
)
return
STATUS_NO_MEMORY
;
if
(
sysctl
(
mib
,
6
,
buf
,
&
needed
,
NULL
,
0
)
<
0
)
{
heap_
free
(
buf
);
free
(
buf
);
return
STATUS_NOT_SUPPORTED
;
}
...
...
@@ -1225,7 +1224,7 @@ static NTSTATUS ipv4_forward_enumerate_all( void *key_data, DWORD key_size, void
}
num
++
;
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
free
(
buf
);
}
#else
FIXME
(
"not implemented
\n
"
);
...
...
dlls/nsiproxy.sys/ndis.c
View file @
f6917bad
...
...
@@ -84,7 +84,6 @@
#include "ddk/wdm.h"
#include "wine/nsi.h"
#include "wine/list.h"
#include "wine/heap.h"
#include "wine/debug.h"
#include "nsiproxy_private.h"
...
...
@@ -253,7 +252,7 @@ static WCHAR *strdupAtoW( const char *str )
if
(
!
str
)
return
ret
;
len
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
str
,
-
1
,
NULL
,
0
);
ret
=
heap_
alloc
(
len
*
sizeof
(
WCHAR
)
);
ret
=
m
alloc
(
len
*
sizeof
(
WCHAR
)
);
if
(
ret
)
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
str
,
-
1
,
ret
,
len
);
return
ret
;
}
...
...
@@ -264,7 +263,7 @@ static struct if_entry *add_entry( DWORD index, char *name )
int
name_len
=
strlen
(
name
);
if
(
name_len
>=
IFNAMSIZ
-
1
)
return
NULL
;
entry
=
heap_
alloc
(
sizeof
(
*
entry
)
);
entry
=
m
alloc
(
sizeof
(
*
entry
)
);
if
(
!
entry
)
return
NULL
;
entry
->
if_index
=
index
;
...
...
@@ -272,7 +271,7 @@ static struct if_entry *add_entry( DWORD index, char *name )
entry
->
if_name
=
strdupAtoW
(
name
);
if
(
!
entry
->
if_name
)
{
heap_
free
(
entry
);
free
(
entry
);
return
NULL
;
}
...
...
@@ -385,7 +384,7 @@ static void ifinfo_fill_dynamic( struct if_entry *entry, struct nsi_ndis_ifinfo_
struct
if_data
ifdata
;
if
(
sysctl
(
mib
,
ARRAY_SIZE
(
mib
),
NULL
,
&
needed
,
NULL
,
0
)
==
-
1
)
goto
done
;
buf
=
heap_
alloc
(
needed
);
buf
=
m
alloc
(
needed
);
if
(
!
buf
)
goto
done
;
if
(
sysctl
(
mib
,
ARRAY_SIZE
(
mib
),
buf
,
&
needed
,
NULL
,
0
)
==
-
1
)
goto
done
;
for
(
end
=
buf
+
needed
;
buf
<
end
;
buf
+=
ifm
->
ifm_msglen
)
...
...
@@ -408,7 +407,7 @@ static void ifinfo_fill_dynamic( struct if_entry *entry, struct nsi_ndis_ifinfo_
}
}
done:
heap_
free
(
buf
);
free
(
buf
);
}
#endif
}
...
...
dlls/nsiproxy.sys/tcp.c
View file @
f6917bad
...
...
@@ -97,7 +97,6 @@
#include "netiodef.h"
#include "ws2ipdef.h"
#include "tcpmib.h"
#include "wine/heap.h"
#include "wine/nsi.h"
#include "wine/debug.h"
#include "wine/server.h"
...
...
@@ -269,7 +268,7 @@ struct ipv6_addr_scope *get_ipv6_addr_scope_table( unsigned int *size )
{
if
(
!
table_size
)
table_size
=
4
;
else
table_size
*=
2
;
if
(
!
(
table
=
heap_
realloc
(
table
,
table_size
*
sizeof
(
table
[
0
])
)))
if
(
!
(
table
=
realloc
(
table
,
table_size
*
sizeof
(
table
[
0
])
)))
{
fclose
(
fp
);
goto
failed
;
...
...
@@ -301,7 +300,7 @@ struct ipv6_addr_scope *get_ipv6_addr_scope_table( unsigned int *size )
{
if
(
!
table_size
)
table_size
=
4
;
else
table_size
*=
2
;
if
(
!
(
table
=
heap_
realloc
(
table
,
table_size
*
sizeof
(
table
[
0
])
)))
if
(
!
(
table
=
realloc
(
table
,
table_size
*
sizeof
(
table
[
0
])
)))
{
freeifaddrs
(
addrs
);
goto
failed
;
...
...
@@ -325,7 +324,7 @@ struct ipv6_addr_scope *get_ipv6_addr_scope_table( unsigned int *size )
return
table
;
failed:
heap_
free
(
table
);
free
(
table
);
return
NULL
;
}
...
...
@@ -356,7 +355,7 @@ struct pid_map *get_pid_map( unsigned int *num_entries )
NTSTATUS
ret
;
char
*
buffer
=
NULL
,
*
new_buffer
;
if
(
!
(
buffer
=
heap_
alloc
(
buffer_len
)))
return
NULL
;
if
(
!
(
buffer
=
m
alloc
(
buffer_len
)))
return
NULL
;
for
(;;)
{
...
...
@@ -371,17 +370,17 @@ struct pid_map *get_pid_map( unsigned int *num_entries )
if
(
ret
!=
STATUS_INFO_LENGTH_MISMATCH
)
break
;
if
(
!
(
new_buffer
=
heap_
realloc
(
buffer
,
buffer_len
)))
if
(
!
(
new_buffer
=
realloc
(
buffer
,
buffer_len
)))
{
heap_
free
(
buffer
);
free
(
buffer
);
return
NULL
;
}
buffer
=
new_buffer
;
}
if
(
!
(
map
=
heap_
alloc
(
process_count
*
sizeof
(
*
map
)
)))
if
(
!
(
map
=
m
alloc
(
process_count
*
sizeof
(
*
map
)
)))
{
heap_
free
(
buffer
);
free
(
buffer
);
return
NULL
;
}
...
...
@@ -400,7 +399,7 @@ struct pid_map *get_pid_map( unsigned int *num_entries )
pos
+=
process
->
thread_count
*
sizeof
(
struct
thread_info
);
}
heap_
free
(
buffer
);
free
(
buffer
);
*
num_entries
=
process_count
;
return
map
;
}
...
...
@@ -495,7 +494,7 @@ unsigned int find_owning_pid( struct pid_map *map, unsigned int num_entries, UIN
int
fd_len
=
proc_pidinfo
(
map
[
i
].
unix_pid
,
PROC_PIDLISTFDS
,
0
,
NULL
,
0
);
if
(
fd_len
<=
0
)
continue
;
fds
=
heap_
alloc
(
fd_len
);
fds
=
m
alloc
(
fd_len
);
if
(
!
fds
)
continue
;
proc_pidinfo
(
map
[
i
].
unix_pid
,
PROC_PIDLISTFDS
,
0
,
fds
,
fd_len
);
...
...
@@ -507,12 +506,12 @@ unsigned int find_owning_pid( struct pid_map *map, unsigned int num_entries, UIN
proc_pidfdinfo
(
map
[
i
].
unix_pid
,
fds
[
j
].
proc_fd
,
PROC_PIDFDSOCKETINFO
,
&
sock
,
sizeof
(
sock
)
);
if
(
sock
.
psi
.
soi_pcb
==
inode
)
{
heap_
free
(
fds
);
free
(
fds
);
return
map
[
i
].
pid
;
}
}
heap_
free
(
fds
);
free
(
fds
);
}
return
0
;
#else
...
...
@@ -638,7 +637,7 @@ static NTSTATUS tcp_conns_enumerate_all( DWORD filter, struct nsi_tcp_conn_key *
goto
err
;
}
buf
=
heap_
alloc
(
len
);
buf
=
m
alloc
(
len
);
if
(
!
buf
)
{
status
=
STATUS_NO_MEMORY
;
...
...
@@ -728,7 +727,7 @@ static NTSTATUS tcp_conns_enumerate_all( DWORD filter, struct nsi_tcp_conn_key *
num
++
;
}
err:
heap_
free
(
buf
);
free
(
buf
);
}
#else
FIXME
(
"not implemented
\n
"
);
...
...
@@ -738,8 +737,8 @@ static NTSTATUS tcp_conns_enumerate_all( DWORD filter, struct nsi_tcp_conn_key *
if
(
!
want_data
||
num
<=
*
count
)
*
count
=
num
;
else
status
=
STATUS_BUFFER_OVERFLOW
;
heap_
free
(
pid_map
);
heap_
free
(
addr_scopes
);
free
(
pid_map
);
free
(
addr_scopes
);
return
status
;
}
...
...
dlls/nsiproxy.sys/udp.c
View file @
f6917bad
...
...
@@ -77,7 +77,6 @@
#include "netiodef.h"
#include "ws2ipdef.h"
#include "udpmib.h"
#include "wine/heap.h"
#include "wine/nsi.h"
#include "wine/debug.h"
#include "wine/server.h"
...
...
@@ -309,7 +308,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, DWORD key_size, void
goto
err
;
}
buf
=
heap_
alloc
(
len
);
buf
=
m
alloc
(
len
);
if
(
!
buf
)
{
status
=
STATUS_NO_MEMORY
;
...
...
@@ -386,7 +385,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, DWORD key_size, void
num
++
;
}
err:
heap_
free
(
buf
);
free
(
buf
);
}
#else
FIXME
(
"not implemented
\n
"
);
...
...
@@ -396,8 +395,8 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, DWORD key_size, void
if
(
!
want_data
||
num
<=
*
count
)
*
count
=
num
;
else
status
=
STATUS_BUFFER_OVERFLOW
;
heap_
free
(
pid_map
);
heap_
free
(
addr_scopes
);
free
(
pid_map
);
free
(
addr_scopes
);
return
status
;
}
...
...
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