georgmartius / vid.stab

Video stabilization library
http://public.hronopik.de/vid.stab/
Other
838 stars 110 forks source link

memory leaks #107

Open stalestar opened 3 years ago

stalestar commented 3 years ago

Hi, thanks for grate work!

I find some memory leaks of the vsMotionDetection function:

  1. in the vs_vector_filter, vs_vector_append should be replaced by vs_vector_append_dup, and add vs_vector_del(&motions2); behind motionsfine = vs_vector_filter(&motions2, lm_match_better, &meanMatch); in vsMotionDetection meanwhile;
  2. add vs_array_free(matchQualities1); behind double meanMatch = cleanmean(matchQualities1.dat, matchQualities1.len, NULL, NULL); in vsMotionDetection;
  3. add vs_vector_fini(&motionscoarse); vs_vector_fini(&motionsfine); behind *motions = vs_vector_concat(&motionscoarse, &motionsfine); in vsMotionDetection.

You can check the code and fix the problems. Best wishes.