Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
21131b4a
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
接近 2 年 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
21131b4a
编写于
8月 10, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 10, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1051 fix bootevent memory leak and compare function
Merge pull request !1051 from cheng_jinsong/fix_810
上级
dbf39231
4e632f73
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
3 deletion
+14
-3
services/modules/bootevent/bootevent.c
services/modules/bootevent/bootevent.c
+14
-3
未找到文件。
services/modules/bootevent/bootevent.c
浏览文件 @
21131b4a
...
@@ -36,7 +36,7 @@ enum {
...
@@ -36,7 +36,7 @@ enum {
typedef
struct
tagBOOT_EVENT_PARAM_ITEM
{
typedef
struct
tagBOOT_EVENT_PARAM_ITEM
{
ListNode
node
;
ListNode
node
;
c
onst
c
har
*
paramName
;
char
*
paramName
;
struct
timespec
timestamp
[
BOOTEVENT_MAX
];
struct
timespec
timestamp
[
BOOTEVENT_MAX
];
}
BOOT_EVENT_PARAM_ITEM
;
}
BOOT_EVENT_PARAM_ITEM
;
...
@@ -51,6 +51,15 @@ static int BootEventParaListCompareProc(ListNode *node, void *data)
...
@@ -51,6 +51,15 @@ static int BootEventParaListCompareProc(ListNode *node, void *data)
return
-
1
;
return
-
1
;
}
}
static
int
ParseBooteventCompareProc
(
ListNode
*
node
,
void
*
data
)
{
BOOT_EVENT_PARAM_ITEM
*
item
=
(
BOOT_EVENT_PARAM_ITEM
*
)
node
;
if
(
strcmp
(
item
->
paramName
,
(
const
char
*
)
data
)
==
0
)
{
return
0
;
}
return
-
1
;
}
static
int
AddServiceBootEvent
(
const
char
*
serviceName
,
const
char
*
paramName
)
static
int
AddServiceBootEvent
(
const
char
*
serviceName
,
const
char
*
paramName
)
{
{
ServiceExtData
*
extData
=
NULL
;
ServiceExtData
*
extData
=
NULL
;
...
@@ -58,7 +67,7 @@ static int AddServiceBootEvent(const char *serviceName, const char *paramName)
...
@@ -58,7 +67,7 @@ static int AddServiceBootEvent(const char *serviceName, const char *paramName)
if
(
strncmp
(
paramName
,
BOOT_EVENT_PARA_PREFIX
,
BOOT_EVENT_PARA_PREFIX_LEN
)
!=
0
)
{
if
(
strncmp
(
paramName
,
BOOT_EVENT_PARA_PREFIX
,
BOOT_EVENT_PARA_PREFIX_LEN
)
!=
0
)
{
return
-
1
;
return
-
1
;
}
}
found
=
OH_ListFind
(
&
bootEventList
,
(
void
*
)
paramName
,
BootEventParaLis
tCompareProc
);
found
=
OH_ListFind
(
&
bootEventList
,
(
void
*
)
paramName
,
ParseBooteven
tCompareProc
);
if
(
found
!=
NULL
)
{
if
(
found
!=
NULL
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -79,6 +88,7 @@ static int AddServiceBootEvent(const char *serviceName, const char *paramName)
...
@@ -79,6 +88,7 @@ static int AddServiceBootEvent(const char *serviceName, const char *paramName)
}
}
item
->
paramName
=
strdup
(
paramName
);
item
->
paramName
=
strdup
(
paramName
);
if
(
item
->
paramName
==
NULL
)
{
if
(
item
->
paramName
==
NULL
)
{
DelServiceExtData
(
serviceName
,
extData
->
dataId
);
INIT_LOGI
(
"strdup failed"
);
INIT_LOGI
(
"strdup failed"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -145,7 +155,7 @@ static void ServiceParseBootEventHook(SERVICE_PARSE_CTX *serviceParseCtx)
...
@@ -145,7 +155,7 @@ static void ServiceParseBootEventHook(SERVICE_PARSE_CTX *serviceParseCtx)
if
(
AddServiceBootEvent
(
serviceParseCtx
->
serviceName
,
if
(
AddServiceBootEvent
(
serviceParseCtx
->
serviceName
,
cJSON_GetStringValue
(
item
))
!=
0
)
{
cJSON_GetStringValue
(
item
))
!=
0
)
{
INIT_LOGI
(
"Add service bootevent failed %s"
,
serviceParseCtx
->
serviceName
);
INIT_LOGI
(
"Add service bootevent failed %s"
,
serviceParseCtx
->
serviceName
);
return
;
continue
;
}
}
bootEventNum
++
;
bootEventNum
++
;
}
}
...
@@ -199,6 +209,7 @@ static void ClearServiceBootEvent(SERVICE_INFO_CTX *serviceCtx)
...
@@ -199,6 +209,7 @@ static void ClearServiceBootEvent(SERVICE_INFO_CTX *serviceCtx)
if
(
extData
==
NULL
)
{
if
(
extData
==
NULL
)
{
return
;
return
;
}
}
free
(((
BOOT_EVENT_PARAM_ITEM
*
)
extData
->
data
)
->
paramName
);
OH_ListRemove
(
&
((
BOOT_EVENT_PARAM_ITEM
*
)
extData
->
data
)
->
node
);
OH_ListRemove
(
&
((
BOOT_EVENT_PARAM_ITEM
*
)
extData
->
data
)
->
node
);
DelServiceExtData
(
serviceCtx
->
serviceName
,
i
);
DelServiceExtData
(
serviceCtx
->
serviceName
,
i
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录