Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
6e22639f
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
大约 1 年 前同步成功
通知
9
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6e22639f
编写于
3月 18, 2000
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Eliminate memory leaks in mem_dbg.c.
上级
cde245bd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
20 deletion
+45
-20
apps/openssl.c
apps/openssl.c
+1
-1
crypto/lhash/lhash.c
crypto/lhash/lhash.c
+4
-15
crypto/lhash/lhash.h
crypto/lhash/lhash.h
+1
-0
crypto/mem_dbg.c
crypto/mem_dbg.c
+39
-4
未找到文件。
apps/openssl.c
浏览文件 @
6e22639f
...
...
@@ -206,7 +206,7 @@ end:
EVP_cleanup
();
ERR_free_strings
();
CRYPTO_mem_leaks
(
bio_err
);
if
(
bio_err
!=
NULL
)
{
...
...
crypto/lhash/lhash.c
浏览文件 @
6e22639f
...
...
@@ -422,21 +422,6 @@ static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash)
return
(
ret
);
}
/*
unsigned long lh_strhash(char *str)
{
int i,l;
unsigned long ret=0;
unsigned short *s;
if (str == NULL) return(0);
l=(strlen(str)+1)/2;
s=(unsigned short *)str;
for (i=0; i<l; i++)
ret^=(s[i]<<(i&0x0f));
return(ret);
} */
/* The following hash seems to work very well on normal text strings
* no collisions on /usr/dict/words and it distributes on %2^n quite
* well, not as good as MD5, but still good.
...
...
@@ -470,3 +455,7 @@ unsigned long lh_strhash(const char *c)
return
((
ret
>>
16
)
^
ret
);
}
unsigned
long
lh_num_items
(
LHASH
*
lh
)
{
return
lh
?
lh
->
num_items
:
0
;
}
crypto/lhash/lhash.h
浏览文件 @
6e22639f
...
...
@@ -124,6 +124,7 @@ void *lh_retrieve(LHASH *lh, void *data);
void
lh_doall
(
LHASH
*
lh
,
void
(
*
func
)(
/*void *b*/
));
void
lh_doall_arg
(
LHASH
*
lh
,
void
(
*
func
)(
/*void *a,void *b*/
),
void
*
arg
);
unsigned
long
lh_strhash
(
const
char
*
c
);
unsigned
long
lh_num_items
(
LHASH
*
lh
);
#ifndef NO_FP_API
void
lh_stats
(
LHASH
*
lh
,
FILE
*
out
);
...
...
crypto/mem_dbg.c
浏览文件 @
6e22639f
...
...
@@ -640,19 +640,54 @@ void CRYPTO_mem_leaks(BIO *b)
MEM_LEAK
ml
;
char
buf
[
80
];
if
(
mh
==
NULL
)
return
;
if
(
mh
==
NULL
&&
amih
==
NULL
)
return
;
ml
.
bio
=
b
;
ml
.
bytes
=
0
;
ml
.
chunks
=
0
;
CRYPTO_w_lock
(
CRYPTO_LOCK_MALLOC2
);
lh_doall_arg
(
mh
,(
void
(
*
)())
print_leak
,(
char
*
)
&
ml
);
CRYPTO_w_unlock
(
CRYPTO_LOCK_MALLOC2
);
MemCheck_off
();
/* obtains CRYPTO_LOCK_MALLOC2 */
if
(
mh
!=
NULL
)
lh_doall_arg
(
mh
,(
void
(
*
)())
print_leak
,(
char
*
)
&
ml
);
if
(
ml
.
chunks
!=
0
)
{
sprintf
(
buf
,
"%ld bytes leaked in %d chunks
\n
"
,
ml
.
bytes
,
ml
.
chunks
);
BIO_puts
(
b
,
buf
);
}
else
{
/* Make sure that, if we found no leaks, memory-leak debugging itself
* does not introduce memory leaks (which might irritate
* external debugging tools).
* (When someone enables leak checking, but does not call
* this function, we declare it to be their fault.)
*
* XXX This should be in CRYPTO_mem_leaks_cb,
* and CRYPTO_mem_leaks should be implemented by
* using CRYPTO_mem_leaks_cb.
* (Also their should be a variant of lh_doall_arg
* that takes a function pointer instead of a void *;
* this would obviate the ugly and illegal
* void_fn_to_char kludge in CRYPTO_mem_leaks_cb.
* Otherwise the code police will come and get us.)
*/
CRYPTO_w_lock
(
CRYPTO_LOCK_MALLOC
);
if
(
mh
!=
NULL
)
{
lh_free
(
mh
);
mh
=
NULL
;
}
if
(
amih
!=
NULL
)
{
if
(
lh_num_items
(
amih
)
==
0
)
{
lh_free
(
amih
);
amih
=
NULL
;
}
}
CRYPTO_w_unlock
(
CRYPTO_LOCK_MALLOC
);
}
MemCheck_on
();
/* releases CRYPTO_LOCK_MALLOC2 */
#if 0
lh_stats_bio(mh,b);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录