mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Fix memory leak and passive notification issues
This commit is contained in:
parent
f8e695e35c
commit
efa23e8983
4 changed files with 13 additions and 17 deletions
2
config.c
2
config.c
|
|
@ -1207,7 +1207,7 @@ int cwmp_init(int argc, char** argv,struct cwmp *cwmp)
|
|||
return error;
|
||||
|
||||
cwmp_get_deviceid(cwmp);
|
||||
dm_entry_load_enabled_notify(DM_CWMP, cwmp->conf.amd_version, cwmp->conf.instance_mode, add_list_value_change, send_active_value_change);
|
||||
//dm_entry_load_enabled_notify(DM_CWMP, cwmp->conf.amd_version, cwmp->conf.instance_mode, add_list_value_change, send_active_value_change);
|
||||
return CWMP_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
6
cwmp.c
6
cwmp.c
|
|
@ -176,7 +176,10 @@ void cwmp_schedule_session (struct cwmp *cwmp)
|
|||
}
|
||||
|
||||
session = list_entry(ilist, struct session, list);
|
||||
|
||||
//free_dm_parameter_all_fromlist(&list_value_change);
|
||||
if( access( DM_ENABLED_NOTIFY, F_OK ) != -1 )
|
||||
check_value_change();
|
||||
dmbbf_update_enabled_notify_file(DM_CWMP, cwmp->conf.amd_version, cwmp->conf.instance_mode);
|
||||
cwmp_prepare_value_change(cwmp, session);
|
||||
|
||||
if ((error = cwmp_move_session_to_session_send (cwmp, session))) {
|
||||
|
|
@ -189,7 +192,6 @@ void cwmp_schedule_session (struct cwmp *cwmp)
|
|||
cwmp->session_status.last_status = SESSION_RUNNING;
|
||||
cwmp->session_status.next_retry = 0;
|
||||
|
||||
cwmp_add_notification_min();
|
||||
if (access(fc_cookies, F_OK) != -1)
|
||||
remove(fc_cookies);
|
||||
CWMP_LOG (INFO,"Start session");
|
||||
|
|
|
|||
20
event.c
20
event.c
|
|
@ -273,7 +273,7 @@ void cwmp_lwnotification()
|
|||
FREE(msg_out);
|
||||
}
|
||||
|
||||
void cwmp_add_notification_min(void)
|
||||
void check_value_change(void)
|
||||
{
|
||||
int fault, iscopy;
|
||||
FILE *fp;
|
||||
|
|
@ -283,14 +283,14 @@ void cwmp_add_notification_min(void)
|
|||
struct dm_parameter *dm_parameter;
|
||||
struct dmctx dmctx = {0};
|
||||
|
||||
cwmp_dm_ctx_init(&cwmp_main, &dmctx);
|
||||
|
||||
fp = fopen(DM_ENABLED_NOTIFY, "r");
|
||||
if (fp == NULL)
|
||||
return;
|
||||
|
||||
while (fgets(buf, 512, fp) != NULL) {
|
||||
dm_ctx_init_sub(&dmctx, DM_CWMP, cwmp_main.conf.amd_version, cwmp_main.conf.instance_mode);
|
||||
dm_ctx_init(&dmctx, DM_CWMP, cwmp_main.conf.amd_version, cwmp_main.conf.instance_mode);
|
||||
dmctx.in_param = "";
|
||||
int len = strlen(buf);
|
||||
if (len)
|
||||
buf[len-1] = '\0';
|
||||
|
|
@ -305,23 +305,17 @@ void cwmp_add_notification_min(void)
|
|||
fault = dm_entry_param_method(&dmctx, CMD_GET_VALUE, parameter, NULL, NULL);
|
||||
if (!fault && dmctx.list_parameter.next != &dmctx.list_parameter) {
|
||||
dm_parameter = list_entry(dmctx.list_parameter.next, struct dm_parameter, list);
|
||||
if (strcmp(dm_parameter->data, value) != 0 && notification[0] == '1') {
|
||||
|
||||
dm_update_file_enabled_notify(parameter, dm_parameter->data);
|
||||
iscopy = copy_temporary_file_to_original_file(DM_ENABLED_NOTIFY, DM_ENABLED_NOTIFY_TEMPORARY);
|
||||
|
||||
if(iscopy)
|
||||
remove(DM_ENABLED_NOTIFY_TEMPORARY);
|
||||
add_list_value_change(parameter, dm_parameter->data, dm_parameter->type);
|
||||
}
|
||||
if (strcmp(dm_parameter->data, value) != 0 && notification[0] == '1')
|
||||
add_dm_parameter_tolist(&list_value_change, parameter, dm_parameter->data, dm_parameter->type);
|
||||
}
|
||||
FREE(value);
|
||||
FREE(notification);
|
||||
FREE(parameter);
|
||||
dm_ctx_clean(&dmctx);
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
cwmp_dm_ctx_clean(cwmp, &dmctx);
|
||||
|
||||
}
|
||||
|
||||
void cwmp_add_notification(void)
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ int event_remove_noretry_event_container(struct session *session, struct cwmp *c
|
|||
void cwmp_save_event_container (struct cwmp *cwmp,struct event_container *event_container);
|
||||
void *thread_event_periodic (void *v);
|
||||
void cwmp_add_notification(void);
|
||||
void cwmp_add_notification_min(void);
|
||||
void check_value_change(void);
|
||||
int netlink_init(void);
|
||||
char * mix_get_time(void);
|
||||
char * mix_get_time_of(time_t t_time);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue