Do not try to free the static ra_filter (#105)

Fixes: https://github.com/espressif/esp-who/issues/101
pull/104/head
Me No Dev 2019-08-10 05:46:28 +03:00 committed by XiaochaoGONG
parent 49ecd1a2b6
commit 447b873ad8
1 changed files with 9 additions and 10 deletions

View File

@ -47,14 +47,6 @@ static const char* TAG = "camera_httpd";
#define FACE_COLOR_PURPLE (FACE_COLOR_BLUE | FACE_COLOR_RED)
#endif
typedef struct {
size_t size; //number of values used for filtering
size_t index; //current value index
size_t count; //value count
int sum;
int * values; //array to be filled with values
} ra_filter_t;
typedef struct {
httpd_req_t *req;
size_t len;
@ -65,7 +57,6 @@ static const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary="
static const char* _STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
static const char* _STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n";
static ra_filter_t ra_filter;
httpd_handle_t stream_httpd = NULL;
httpd_handle_t camera_httpd = NULL;
#if CONFIG_ESP_FACE_DETECT_ENABLED
@ -77,6 +68,15 @@ static int8_t is_enrolling = 0;
static face_id_list id_list = {0};
#endif
#endif
typedef struct {
size_t size; //number of values used for filtering
size_t index; //current value index
size_t count; //value count
int sum;
int * values; //array to be filled with values
} ra_filter_t;
static ra_filter_t ra_filter;
static ra_filter_t * ra_filter_init(ra_filter_t * filter, size_t sample_size){
@ -84,7 +84,6 @@ static ra_filter_t * ra_filter_init(ra_filter_t * filter, size_t sample_size){
filter->values = (int *)malloc(sample_size * sizeof(int));
if(!filter->values){
free(filter);
return NULL;
}
memset(filter->values, 0, sample_size * sizeof(int));