Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
k-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈伟灿
k-sdk
Commits
96115f2e
Commit
96115f2e
authored
Mar 17, 2022
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】内存泄漏修改
【提交人】陈伟灿
parent
471e3b48
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
15 deletions
+41
-15
midware/midware/area/kk_area_handle.c
midware/midware/area/kk_area_handle.c
+1
-0
midware/midware/dm/kk_linkkit.c
midware/midware/dm/kk_linkkit.c
+1
-1
midware/midware/dm/kk_motor_bind_db.c
midware/midware/dm/kk_motor_bind_db.c
+5
-5
midware/midware/dm/kk_property_db.c
midware/midware/dm/kk_property_db.c
+4
-0
midware/midware/dm/kk_sync_data.c
midware/midware/dm/kk_sync_data.c
+17
-5
midware/midware/group/kk_group_db.c
midware/midware/group/kk_group_db.c
+4
-4
midware/midware/scene/kk_scene_handle.c
midware/midware/scene/kk_scene_handle.c
+9
-0
No files found.
midware/midware/area/kk_area_handle.c
View file @
96115f2e
...
...
@@ -887,6 +887,7 @@ kk_dev_list_t* kk_get_room_deviceCode(const char* roomId)
}
}
sqlite3_finalize
(
stmt
);
sqlite3_free
(
sqlCmd
);
_kk_area_unlock
();
return
s_device_list
;
}
...
...
midware/midware/dm/kk_linkkit.c
View file @
96115f2e
...
...
@@ -1216,7 +1216,7 @@ static void kk_strdel(char* s,char del_x)
*
q
=*
p
;
}
static
int
_kk_mac_str_to_upper
(
char
*
s
)
static
int
_kk_mac_str_to_upper
(
char
*
s
)
{
if
(
s
==
NULL
){
return
-
1
;
...
...
midware/midware/dm/kk_motor_bind_db.c
View file @
96115f2e
...
...
@@ -247,6 +247,7 @@ int kk_motor_bind_db_find_byDeviceCode(const char* panelDCode,struct kk_motor_bi
}
sqlite3_finalize
(
stmt
);
sqlite3_free
(
sqlCmd
);
_kk_motor_bind_unlock
();
return
listSize
;
}
...
...
@@ -281,7 +282,7 @@ int kk_motor_bind_db_find_byMotorDeviceCode(const char* motorCode,struct kk_moto
}
pInfo
++
;
}
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
_kk_motor_bind_unlock
();
return
listSize
;
...
...
@@ -303,7 +304,6 @@ int kk_motor_bind_db_find(const char* panelDCode,int panelEpNum,struct kk_motor_
sqlCmd
=
sqlite3_mprintf
(
searchCmd
,
panelDCode
,
panelEpNum
);
INFO_PRINT
(
"Table searchCmd:%s
\n
"
,
sqlCmd
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
motorDeviceCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
MOTOR_BIND_DB_MOTOR_DEVICECODE
);
...
...
@@ -319,7 +319,7 @@ int kk_motor_bind_db_find(const char* panelDCode,int panelEpNum,struct kk_motor_
}
pInfo
++
;
}
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
_kk_motor_bind_unlock
();
return
listSize
;
...
...
@@ -356,7 +356,7 @@ int kk_motor_bind_db_find_ex(int dummyId,struct kk_motor_bind_info* info,int max
}
pInfo
++
;
}
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
_kk_motor_bind_unlock
();
return
listSize
;
...
...
@@ -383,7 +383,7 @@ int kk_motor_bind_db_find_dummyId(const char* panelDCode,int panelEpNum,const ch
dummyId
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_DUMMYID
);
INFO_PRINT
(
"dummyId=%d
\n
"
,
dummyId
);
}
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
_kk_motor_bind_unlock
();
return
dummyId
;
...
...
midware/midware/dm/kk_property_db.c
View file @
96115f2e
...
...
@@ -896,6 +896,10 @@ int kk_indoorAir_query_epnums(const char *deviceCode,int epList[])
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
if
(
count
>
64
){
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
_kk_property_db_unlock
();
return
count
;
}
INFO_PRINT
(
"-----------------------------------------------kk_indoorAir_query_epnums count:%d
\n
"
,
count
);
...
...
midware/midware/dm/kk_sync_data.c
View file @
96115f2e
...
...
@@ -519,12 +519,13 @@ static cJSON *kk_get_subfreshair_properties_info(char *deviceCode)
online
=
kk_subFreshAir_get_online
(
deviceCode
,
eplist
[
i
]);
cJSON_AddNumberToObject
(
propertyItem
,
"onlineStatus"
,
online
);
cJSON_AddItemToArray
(
eps
,
propertyItem
);
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
}
cJSON_AddItemToObject
(
obj
,
"eps"
,
eps
);
cJSON_AddNumberToObject
(
obj
,
"EpTotal"
,
count
);
cJSON_AddNumberToObject
(
obj
,
"CombineDeviceFlag"
,
1
);
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
return
obj
;
}
static
cJSON
*
kk_get_subAirSwitch_properties_info
(
char
*
deviceCode
)
...
...
@@ -569,12 +570,13 @@ static cJSON *kk_get_subAirSwitch_properties_info(char *deviceCode)
online
=
kk_subAirSwitch_get_online
(
deviceCode
,
eplist
[
i
]);
cJSON_AddNumberToObject
(
propertyItem
,
"onlineStatus"
,
online
);
cJSON_AddItemToArray
(
eps
,
propertyItem
);
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
}
cJSON_AddItemToObject
(
obj
,
"eps"
,
eps
);
cJSON_AddNumberToObject
(
obj
,
"EpTotal"
,
count
);
cJSON_AddNumberToObject
(
obj
,
"CombineDeviceFlag"
,
1
);
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
return
obj
;
}
static
cJSON
*
kk_get_properties_info_obj
(
char
*
deviceCode
)
...
...
@@ -1075,6 +1077,8 @@ static int kk_get_scenes_actions_productTypeinfo(cJSON *actionArray,char* id,cha
cJSON_AddStringToObject
(
actionItem
,
KK_SYNC_ROOMID_STR
,
roomId
);
cJSON_AddItemToArray
(
actionArray
,
actionItem
);
}
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
return
0
;
}
static
int
kk_get_scenes_actions_info
(
cJSON
*
actionArray
,
char
*
id
,
char
*
productType
)
...
...
@@ -1190,8 +1194,12 @@ int kk_is_trigger_timing(char *sceneId)
sqlCmd
=
sqlite3_mprintf
(
"select * from SceneTimerInfo where sceneId = %s"
,
sceneId
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
return
1
;
}
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
return
0
;
}
...
...
@@ -1247,7 +1255,9 @@ static int kk_get_scenes_trigger_info(cJSON *triggerObj,char *sceneId)
cJSON_AddItemToArray
(
triggerAry
,
conditionItem
);
}
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
sqlCmd
=
sqlite3_mprintf
(
"select * from SceneTriggerInfo where sceneId = %s and active = %d"
,
sceneId
,
1
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
...
...
@@ -1342,6 +1352,8 @@ static int kk_get_scenes_condition_info(cJSON *conditionObj,char *sceneId)
cJSON_AddItemToArray
(
conditionAry
,
conditionItem
);
}
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
char
*
deviceCode
=
NULL
;
char
*
propertyName
=
NULL
;
...
...
midware/midware/group/kk_group_db.c
View file @
96115f2e
...
...
@@ -340,7 +340,7 @@ static cJSON *kk_group_device_db_query(const char *groupId,int isSync)
cJSON_AddItemToArray
(
didListAry
,
didListItem
);
}
sqlite3_finalize
(
stmt
);
sqlite3_free
(
sqlCmd
);
return
didListAry
;
}
...
...
@@ -384,7 +384,7 @@ cJSON *kk_group_db_query(int isSync)
cJSON_AddItemToObject
(
groupListItem
,
"didList"
,
didListAry
);
cJSON_AddItemToArray
(
groupListAry
,
groupListItem
);
}
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
_kk_group_unlock
();
return
groupListAry
;
...
...
@@ -439,7 +439,7 @@ cJSON *kk_group_device_db_exe_act(const char *groupId,int controlType,int proper
cJSON_AddItemToArray
(
actionsAry
,
actionItem
);
}
sqlite3_finalize
(
stmt
);
sqlite3_free
(
sqlCmd
);
return
actionsAry
;
}
...
...
@@ -462,7 +462,7 @@ int kk_group_device_db_find_parent(const char *groupId,char *parent)
break
;
}
sqlite3_finalize
(
stmt
);
sqlite3_free
(
sqlCmd
);
return
0
;
}
...
...
midware/midware/scene/kk_scene_handle.c
View file @
96115f2e
...
...
@@ -2939,6 +2939,9 @@ static int _kk_rebuild_device_active(char *sceneid)
cJSON
*
propertyValueJson
=
cJSON_Parse
(
propertyValueStr
);
if
(
propertyValueJson
==
NULL
)
{
ERROR_PRINT
(
"cJSON_Parse ERROR!!!"
);
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
cJSON_Delete
(
array
);
return
FAIL_RETURN
;
}
_kk_scene_LightStripSpecialAction_handle
(
propertyValueJson
,
pDeviceCode
,
epNum
,
idelay
,(
char
*
)
sceneid
,(
char
*
)
gwDeviceCode
);
...
...
@@ -2949,6 +2952,9 @@ static int _kk_rebuild_device_active(char *sceneid)
cJSON
*
propertyValueJson
=
cJSON_Parse
(
propertyValueStr
);
if
(
propertyValueJson
==
NULL
)
{
ERROR_PRINT
(
"cJSON_Parse ERROR!!!"
);
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
cJSON_Delete
(
array
);
return
FAIL_RETURN
;
}
_kk_scene_AirConditionerIndoorUnitSpecialAction_handle
(
propertyValueJson
,
pDeviceCode
,
epNum
,
idelay
,(
char
*
)
sceneid
,(
char
*
)
gwDeviceCode
);
...
...
@@ -2986,6 +2992,9 @@ static int _kk_rebuild_device_active(char *sceneid)
kk_scene_action_info_send
(
1
);
}
}
if
(
isMuti
==
0
){
cJSON_Delete
(
array
);
}
sqlite3_free
(
sqlCmd
);
sqlite3_finalize
(
stmt
);
return
0
;
...
...
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