mirror of
https://github.com/Motion-Project/motion.git
synced 2026-04-18 21:17:04 -04:00
Log Level for Mask and Memory Leak
Revise the log level to warning when the user has specified a pgm mask file that is different than the size of the image from the camera. Free the memory associated with mask image to close memory leak.
This commit is contained in:
3
motion.c
3
motion.c
@@ -1018,6 +1018,9 @@ static void motion_cleanup(struct context *cnt)
|
||||
free(cnt->imgs.smartmask_buffer);
|
||||
cnt->imgs.smartmask_buffer = NULL;
|
||||
|
||||
if (cnt->imgs.mask) free(cnt->imgs.mask);
|
||||
cnt->imgs.mask = NULL;
|
||||
|
||||
free(cnt->imgs.common_buffer);
|
||||
cnt->imgs.common_buffer = NULL;
|
||||
|
||||
|
||||
@@ -1018,7 +1018,8 @@ unsigned char *get_pgm(FILE *picture, int width, int height)
|
||||
|
||||
/* Resize mask if required */
|
||||
if (mask_width != width || mask_height != height) {
|
||||
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Mask needs resizing from %dx%d to %dx%d",
|
||||
MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO, "%s: The mask file specified is not the same size as image from camera.");
|
||||
MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO, "%s: Attempting to resize mask image from %dx%d to %dx%d",
|
||||
mask_width, mask_height, width, height);
|
||||
|
||||
resized_image = mymalloc(width * height);
|
||||
|
||||
Reference in New Issue
Block a user