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
001a9361
Commit
001a9361
authored
Mar 11, 2005
by
Peter Berg Larsen
Committed by
Alexandre Julliard
Mar 11, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assorted memleak fixes. Found on Michael Stefaniuc smatch list.
parent
393d16a6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
20 deletions
+33
-20
driver.c
dlls/winmm/driver.c
+6
-5
mmio.c
dlls/winmm/mmio.c
+4
-3
mmsystem.c
dlls/winmm/mmsystem.c
+8
-5
time.c
dlls/winmm/time.c
+3
-3
socket.c
dlls/wsock32/socket.c
+12
-4
No files found.
dlls/winmm/driver.c
View file @
001a9361
...
@@ -308,13 +308,13 @@ HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lPara
...
@@ -308,13 +308,13 @@ HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lPara
INT
len
;
INT
len
;
LPWSTR
dn
=
NULL
;
LPWSTR
dn
=
NULL
;
LPWSTR
sn
=
NULL
;
LPWSTR
sn
=
NULL
;
HDRVR
ret
;
HDRVR
ret
=
0
;
if
(
lpDriverName
)
if
(
lpDriverName
)
{
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpDriverName
,
-
1
,
NULL
,
0
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpDriverName
,
-
1
,
NULL
,
0
);
dn
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
dn
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
dn
)
return
0
;
if
(
!
dn
)
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
lpDriverName
,
-
1
,
dn
,
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
lpDriverName
,
-
1
,
dn
,
len
);
}
}
...
@@ -322,14 +322,15 @@ HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lPara
...
@@ -322,14 +322,15 @@ HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lPara
{
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpSectionName
,
-
1
,
NULL
,
0
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpSectionName
,
-
1
,
NULL
,
0
);
sn
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
sn
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
sn
)
return
0
;
if
(
!
sn
)
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
lpSectionName
,
-
1
,
sn
,
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
lpSectionName
,
-
1
,
sn
,
len
);
}
}
ret
=
OpenDriver
(
dn
,
sn
,
lParam
);
ret
=
OpenDriver
(
dn
,
sn
,
lParam
);
if
(
dn
)
HeapFree
(
GetProcessHeap
(),
0
,
dn
);
done:
if
(
sn
)
HeapFree
(
GetProcessHeap
(),
0
,
sn
);
HeapFree
(
GetProcessHeap
(),
0
,
dn
);
HeapFree
(
GetProcessHeap
(),
0
,
sn
);
return
ret
;
return
ret
;
}
}
...
...
dlls/winmm/mmio.c
View file @
001a9361
...
@@ -1360,26 +1360,27 @@ MMRESULT WINAPI mmioRenameW(LPCWSTR szFileName, LPCWSTR szNewFileName,
...
@@ -1360,26 +1360,27 @@ MMRESULT WINAPI mmioRenameW(LPCWSTR szFileName, LPCWSTR szNewFileName,
{
{
LPSTR
szFn
=
NULL
;
LPSTR
szFn
=
NULL
;
LPSTR
sznFn
=
NULL
;
LPSTR
sznFn
=
NULL
;
UINT
ret
;
UINT
ret
=
MMSYSERR_NOMEM
;
INT
len
;
INT
len
;
if
(
szFileName
)
if
(
szFileName
)
{
{
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
szFileName
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
szFileName
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
szFn
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
szFn
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
!
szFn
)
return
MMSYSERR_NOMEM
;
if
(
!
szFn
)
goto
done
;
WideCharToMultiByte
(
CP_ACP
,
0
,
szFileName
,
-
1
,
szFn
,
len
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
szFileName
,
-
1
,
szFn
,
len
,
NULL
,
NULL
);
}
}
if
(
szNewFileName
)
if
(
szNewFileName
)
{
{
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
szNewFileName
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
szNewFileName
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
sznFn
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
sznFn
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
!
sznFn
)
return
MMSYSERR_NOMEM
;
if
(
!
sznFn
)
goto
done
;
WideCharToMultiByte
(
CP_ACP
,
0
,
szNewFileName
,
-
1
,
sznFn
,
len
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
szNewFileName
,
-
1
,
sznFn
,
len
,
NULL
,
NULL
);
}
}
ret
=
mmioRenameA
(
szFn
,
sznFn
,
lpmmioinfo
,
dwFlags
);
ret
=
mmioRenameA
(
szFn
,
sznFn
,
lpmmioinfo
,
dwFlags
);
done:
HeapFree
(
GetProcessHeap
(),
0
,
szFn
);
HeapFree
(
GetProcessHeap
(),
0
,
szFn
);
HeapFree
(
GetProcessHeap
(),
0
,
sznFn
);
HeapFree
(
GetProcessHeap
(),
0
,
sznFn
);
return
ret
;
return
ret
;
...
...
dlls/winmm/mmsystem.c
View file @
001a9361
...
@@ -2260,7 +2260,7 @@ static WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lPara
...
@@ -2260,7 +2260,7 @@ static WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lPara
LPDRVCONFIGINFO
dci32
=
(
LPDRVCONFIGINFO
)(
*
lParam2
);
LPDRVCONFIGINFO
dci32
=
(
LPDRVCONFIGINFO
)(
*
lParam2
);
if
(
dci16
)
{
if
(
dci16
)
{
LPSTR
str1
;
LPSTR
str1
=
NULL
,
str2
;
INT
len
;
INT
len
;
dci16
->
dwDCISize
=
sizeof
(
DRVCONFIGINFO16
);
dci16
->
dwDCISize
=
sizeof
(
DRVCONFIGINFO16
);
...
@@ -2271,6 +2271,7 @@ static WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lPara
...
@@ -2271,6 +2271,7 @@ static WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lPara
WideCharToMultiByte
(
CP_ACP
,
0
,
dci32
->
lpszDCISectionName
,
-
1
,
str1
,
len
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
dci32
->
lpszDCISectionName
,
-
1
,
str1
,
len
,
NULL
,
NULL
);
dci16
->
lpszDCISectionName
=
MapLS
(
str1
);
dci16
->
lpszDCISectionName
=
MapLS
(
str1
);
}
else
{
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
dci16
);
return
WINMM_MAP_NOMEM
;
return
WINMM_MAP_NOMEM
;
}
}
}
else
{
}
else
{
...
@@ -2278,11 +2279,13 @@ static WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lPara
...
@@ -2278,11 +2279,13 @@ static WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lPara
}
}
if
(
dci32
->
lpszDCIAliasName
)
{
if
(
dci32
->
lpszDCIAliasName
)
{
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
dci32
->
lpszDCIAliasName
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
dci32
->
lpszDCIAliasName
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
str
1
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
str
2
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
str
1
)
{
if
(
str
2
)
{
WideCharToMultiByte
(
CP_ACP
,
0
,
dci32
->
lpszDCIAliasName
,
-
1
,
str
1
,
len
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
dci32
->
lpszDCIAliasName
,
-
1
,
str
2
,
len
,
NULL
,
NULL
);
dci16
->
lpszDCIAliasName
=
MapLS
(
str
1
);
dci16
->
lpszDCIAliasName
=
MapLS
(
str
2
);
}
else
{
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
str1
);
HeapFree
(
GetProcessHeap
(),
0
,
dci16
);
return
WINMM_MAP_NOMEM
;
return
WINMM_MAP_NOMEM
;
}
}
}
else
{
}
else
{
...
...
dlls/winmm/time.c
View file @
001a9361
...
@@ -315,11 +315,11 @@ WORD TIME_SetEventInternal(UINT wDelay, UINT wResol,
...
@@ -315,11 +315,11 @@ WORD TIME_SetEventInternal(UINT wDelay, UINT wResol,
TRACE
(
"(%u, %u, %p, %08lX, %04X);
\n
"
,
wDelay
,
wResol
,
lpFunc
,
dwUser
,
wFlags
);
TRACE
(
"(%u, %u, %p, %08lX, %04X);
\n
"
,
wDelay
,
wResol
,
lpFunc
,
dwUser
,
wFlags
);
lpNewTimer
=
(
LPWINE_TIMERENTRY
)
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WINE_TIMERENTRY
));
if
(
wDelay
<
MMSYSTIME_MININTERVAL
||
wDelay
>
MMSYSTIME_MAXINTERVAL
)
if
(
lpNewTimer
==
NULL
)
return
0
;
return
0
;
if
(
wDelay
<
MMSYSTIME_MININTERVAL
||
wDelay
>
MMSYSTIME_MAXINTERVAL
)
lpNewTimer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WINE_TIMERENTRY
));
if
(
lpNewTimer
==
NULL
)
return
0
;
return
0
;
TIME_MMTimeStart
();
TIME_MMTimeStart
();
...
...
dlls/wsock32/socket.c
View file @
001a9361
...
@@ -436,7 +436,7 @@ DWORD WINAPI WsControl(DWORD protocol,
...
@@ -436,7 +436,7 @@ DWORD WINAPI WsControl(DWORD protocol,
* interface are returned. */
* interface are returned. */
case
CL_NL_ENTITY
:
case
CL_NL_ENTITY
:
{
{
DWORD
routeTableSize
,
numRoutes
,
ndx
;
DWORD
routeTableSize
,
numRoutes
,
ndx
,
ret
;
PMIB_IPFORWARDTABLE
table
;
PMIB_IPFORWARDTABLE
table
;
IPRouteEntry
*
winRouteTable
=
(
IPRouteEntry
*
)
pResponseInfo
;
IPRouteEntry
*
winRouteTable
=
(
IPRouteEntry
*
)
pResponseInfo
;
...
@@ -450,7 +450,11 @@ DWORD WINAPI WsControl(DWORD protocol,
...
@@ -450,7 +450,11 @@ DWORD WINAPI WsControl(DWORD protocol,
table
=
(
PMIB_IPFORWARDTABLE
)
calloc
(
1
,
routeTableSize
);
table
=
(
PMIB_IPFORWARDTABLE
)
calloc
(
1
,
routeTableSize
);
if
(
!
table
)
if
(
!
table
)
return
ERROR_NOT_ENOUGH_MEMORY
;
return
ERROR_NOT_ENOUGH_MEMORY
;
GetIpForwardTable
(
table
,
&
routeTableSize
,
FALSE
);
ret
=
GetIpForwardTable
(
table
,
&
routeTableSize
,
FALSE
);
if
(
ret
!=
NO_ERROR
)
{
free
(
table
);
return
ret
;
}
memset
(
pResponseInfo
,
0
,
sizeof
(
IPRouteEntry
)
*
numRoutes
);
memset
(
pResponseInfo
,
0
,
sizeof
(
IPRouteEntry
)
*
numRoutes
);
for
(
ndx
=
0
;
ndx
<
table
->
dwNumEntries
;
ndx
++
)
for
(
ndx
=
0
;
ndx
<
table
->
dwNumEntries
;
ndx
++
)
...
@@ -496,8 +500,10 @@ DWORD WINAPI WsControl(DWORD protocol,
...
@@ -496,8 +500,10 @@ DWORD WINAPI WsControl(DWORD protocol,
if
(
!
table
)
if
(
!
table
)
return
ERROR_NOT_ENOUGH_MEMORY
;
return
ERROR_NOT_ENOUGH_MEMORY
;
ret
=
GetIpNetTable
(
table
,
&
arpTableSize
,
FALSE
);
ret
=
GetIpNetTable
(
table
,
&
arpTableSize
,
FALSE
);
if
(
ret
!=
NO_ERROR
)
if
(
ret
!=
NO_ERROR
)
{
free
(
table
);
return
ret
;
return
ret
;
}
if
(
*
pcbResponseInfoLen
<
sizeof
(
MIB_IPNETROW
)
*
if
(
*
pcbResponseInfoLen
<
sizeof
(
MIB_IPNETROW
)
*
table
->
dwNumEntries
)
table
->
dwNumEntries
)
{
{
...
@@ -532,8 +538,10 @@ DWORD WINAPI WsControl(DWORD protocol,
...
@@ -532,8 +538,10 @@ DWORD WINAPI WsControl(DWORD protocol,
if
(
!
table
)
if
(
!
table
)
return
ERROR_NOT_ENOUGH_MEMORY
;
return
ERROR_NOT_ENOUGH_MEMORY
;
ret
=
GetTcpTable
(
table
,
&
tcpTableSize
,
FALSE
);
ret
=
GetTcpTable
(
table
,
&
tcpTableSize
,
FALSE
);
if
(
ret
!=
NO_ERROR
)
if
(
ret
!=
NO_ERROR
)
{
free
(
table
);
return
ret
;
return
ret
;
}
if
(
*
pcbResponseInfoLen
<
sizeof
(
MIB_TCPROW
)
*
if
(
*
pcbResponseInfoLen
<
sizeof
(
MIB_TCPROW
)
*
table
->
dwNumEntries
)
table
->
dwNumEntries
)
{
{
...
...
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