Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
dd674689
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dd674689
编写于
5月 22, 2008
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix misc memory leaks
上级
8e5c89ba
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
30 deletion
+51
-30
ChangeLog
ChangeLog
+9
-0
qemud/remote.c
qemud/remote.c
+20
-5
src/libvirt.c
src/libvirt.c
+9
-7
src/qparams.c
src/qparams.c
+13
-18
未找到文件。
ChangeLog
浏览文件 @
dd674689
Thu May 22 11:06:29 EST 2008 Daniel P. Berrange <berrange@redhat.com>
Fix misc memory leaks
* qemud/remote.c: Fix memory leaks in stats/migration APIs
* src/libvirt.c: Fix use of uninitialized memory & memory
leak in default auth helper
* src/qparams.c: Fix memory leak, and convert to use new
style memory allocation APIs
Thu May 22 16:56:12 CEST 2008 Daniel Veillard <veillard@redhat.com>
* docs/formatdomain.html docs/formatdomain.html.in: Anton Protopopov
...
...
qemud/remote.c
浏览文件 @
dd674689
...
...
@@ -792,8 +792,11 @@ remoteDispatchDomainBlockStats (struct qemud_server *server ATTRIBUTE_UNUSED,
}
path
=
args
->
path
;
if
(
virDomainBlockStats
(
dom
,
path
,
&
stats
,
sizeof
stats
)
==
-
1
)
if
(
virDomainBlockStats
(
dom
,
path
,
&
stats
,
sizeof
stats
)
==
-
1
)
{
virDomainFree
(
dom
);
return
-
1
;
}
virDomainFree
(
dom
);
ret
->
rd_req
=
stats
.
rd_req
;
ret
->
rd_bytes
=
stats
.
rd_bytes
;
...
...
@@ -823,8 +826,11 @@ remoteDispatchDomainInterfaceStats (struct qemud_server *server ATTRIBUTE_UNUSED
}
path
=
args
->
path
;
if
(
virDomainInterfaceStats
(
dom
,
path
,
&
stats
,
sizeof
stats
)
==
-
1
)
if
(
virDomainInterfaceStats
(
dom
,
path
,
&
stats
,
sizeof
stats
)
==
-
1
)
{
virDomainFree
(
dom
);
return
-
1
;
}
virDomainFree
(
dom
);
ret
->
rx_bytes
=
stats
.
rx_bytes
;
ret
->
rx_packets
=
stats
.
rx_packets
;
...
...
@@ -1221,14 +1227,22 @@ remoteDispatchDomainMigratePrepare (struct qemud_server *server ATTRIBUTE_UNUSED
r
=
__virDomainMigratePrepare
(
client
->
conn
,
&
cookie
,
&
cookielen
,
uri_in
,
uri_out
,
args
->
flags
,
dname
,
args
->
resource
);
if
(
r
==
-
1
)
return
-
1
;
if
(
r
==
-
1
)
{
free
(
uri_out
);
return
-
1
;
}
/* remoteDispatchClientRequest will free cookie, uri_out and
* the string if there is one.
*/
ret
->
cookie
.
cookie_len
=
cookielen
;
ret
->
cookie
.
cookie_val
=
cookie
;
ret
->
uri_out
=
*
uri_out
==
NULL
?
NULL
:
uri_out
;
if
(
*
uri_out
==
NULL
)
{
ret
->
uri_out
=
NULL
;
free
(
uri_out
);
}
else
{
ret
->
uri_out
=
uri_out
;
}
return
0
;
}
...
...
@@ -1258,6 +1272,7 @@ remoteDispatchDomainMigratePerform (struct qemud_server *server ATTRIBUTE_UNUSED
args
->
cookie
.
cookie_len
,
args
->
uri
,
args
->
flags
,
dname
,
args
->
resource
);
virDomainFree
(
dom
);
if
(
r
==
-
1
)
return
-
1
;
return
0
;
...
...
@@ -1281,7 +1296,7 @@ remoteDispatchDomainMigrateFinish (struct qemud_server *server ATTRIBUTE_UNUSED,
if
(
ddom
==
NULL
)
return
-
1
;
make_nonnull_domain
(
&
ret
->
ddom
,
ddom
);
virDomainFree
(
ddom
);
return
0
;
}
...
...
src/libvirt.c
浏览文件 @
dd674689
...
...
@@ -170,13 +170,15 @@ static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
return
-
1
;
}
if
(
STREQ
(
bufptr
,
""
)
&&
cred
[
i
].
defresult
)
cred
[
i
].
result
=
strdup
(
cred
[
i
].
defresult
);
else
cred
[
i
].
result
=
strdup
(
bufptr
);
if
(
!
cred
[
i
].
result
)
return
-
1
;
cred
[
i
].
resultlen
=
strlen
(
cred
[
i
].
result
);
if
(
cred
[
i
].
type
!=
VIR_CRED_EXTERNAL
)
{
if
(
STREQ
(
bufptr
,
""
)
&&
cred
[
i
].
defresult
)
cred
[
i
].
result
=
strdup
(
cred
[
i
].
defresult
);
else
cred
[
i
].
result
=
strdup
(
bufptr
);
if
(
!
cred
[
i
].
result
)
return
-
1
;
cred
[
i
].
resultlen
=
strlen
(
cred
[
i
].
result
);
}
}
return
0
;
...
...
src/qparams.c
浏览文件 @
dd674689
...
...
@@ -27,7 +27,7 @@
#include <stdarg.h>
#include "buf.h"
#include "memory.h"
#include "qparams.h"
struct
qparam_set
*
...
...
@@ -39,13 +39,12 @@ new_qparam_set (int init_alloc, ...)
if
(
init_alloc
<=
0
)
init_alloc
=
1
;
ps
=
malloc
(
sizeof
(
*
ps
));
if
(
!
ps
)
return
NULL
;
if
(
VIR_ALLOC
(
ps
)
<
0
)
return
NULL
;
ps
->
n
=
0
;
ps
->
alloc
=
init_alloc
;
ps
->
p
=
malloc
(
init_alloc
*
sizeof
(
ps
->
p
[
0
]));
if
(
!
ps
->
p
)
{
free
(
ps
);
if
(
VIR_ALLOC_N
(
ps
->
p
,
ps
->
alloc
)
<
0
)
{
VIR_FREE
(
ps
);
return
NULL
;
}
...
...
@@ -87,13 +86,8 @@ append_qparams (struct qparam_set *ps, ...)
static
int
grow_qparam_set
(
struct
qparam_set
*
ps
)
{
struct
qparam
*
old_p
;
if
(
ps
->
n
>=
ps
->
alloc
)
{
old_p
=
ps
->
p
;
ps
->
p
=
realloc
(
ps
->
p
,
2
*
ps
->
alloc
*
sizeof
(
ps
->
p
[
0
]));
if
(
!
ps
->
p
)
{
ps
->
p
=
old_p
;
if
(
VIR_REALLOC_N
(
ps
->
p
,
ps
->
alloc
*
2
)
<
0
)
{
perror
(
"realloc"
);
return
-
1
;
}
...
...
@@ -115,13 +109,13 @@ append_qparam (struct qparam_set *ps,
pvalue
=
strdup
(
value
);
if
(
!
pvalue
)
{
free
(
pname
);
VIR_FREE
(
pname
);
return
-
1
;
}
if
(
grow_qparam_set
(
ps
)
==
-
1
)
{
free
(
pname
);
free
(
pvalue
);
VIR_FREE
(
pname
);
VIR_FREE
(
pvalue
);
return
-
1
;
}
...
...
@@ -161,10 +155,11 @@ free_qparam_set (struct qparam_set *ps)
int
i
;
for
(
i
=
0
;
i
<
ps
->
n
;
++
i
)
{
free
(
ps
->
p
[
i
].
name
);
free
(
ps
->
p
[
i
].
value
);
VIR_FREE
(
ps
->
p
[
i
].
name
);
VIR_FREE
(
ps
->
p
[
i
].
value
);
}
free
(
ps
);
VIR_FREE
(
ps
->
p
);
VIR_FREE
(
ps
);
}
struct
qparam_set
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录