mirror of
https://github.com/Motion-Project/motion.git
synced 2026-05-08 23:03:20 -04:00
Revise free process to close leaks
This commit is contained in:
@@ -683,7 +683,10 @@ static void motion_cam_delete(struct ctx_motapp *motapp)
|
||||
return;
|
||||
}
|
||||
|
||||
util_free_var(motapp->cam_list[motapp->cam_delete]->dbse);
|
||||
if (motapp->cam_list[motapp->cam_delete]->dbse != NULL) {
|
||||
free(motapp->cam_list[motapp->cam_delete]->dbse);
|
||||
}
|
||||
motapp->cam_list[motapp->cam_delete]->dbse = NULL;
|
||||
|
||||
/* Delete the config context */
|
||||
delete motapp->cam_list[motapp->cam_delete]->conf;
|
||||
@@ -706,7 +709,9 @@ static void motion_cam_delete(struct ctx_motapp *motapp)
|
||||
|
||||
/* Swap out the old list with the new */
|
||||
pthread_mutex_lock(&motapp->mutex_camlst);
|
||||
util_free_var(motapp->cam_list);
|
||||
if (motapp->cam_list != NULL) {
|
||||
free(motapp->cam_list);
|
||||
}
|
||||
motapp->cam_list = tmp;
|
||||
pthread_mutex_unlock(&motapp->mutex_camlst);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user