Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Asd-g authored and qyot27 committed Aug 11, 2023
1 parent ef6086f commit 34a4379
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/avisynth_c/avs_lib.c
Expand Up @@ -80,6 +80,7 @@ int ffms_load_avs_lib( AVS_ScriptEnvironment *env )
LOAD_AVS_FUNC( avs_set_var, 0 );
LOAD_AVS_FUNC( avs_set_global_var, 0 );
LOAD_AVS_FUNC( avs_take_clip, 0 );
LOAD_AVS_FUNC( avs_release_clip, 0 );

ffms_avs_lib.env = env;

Expand Down
1 change: 1 addition & 0 deletions src/avisynth_c/avs_lib.h
Expand Up @@ -67,6 +67,7 @@ typedef struct ffms_avs_lib_t
AVSC_DECLARE_FUNC( avs_set_var );
AVSC_DECLARE_FUNC( avs_set_global_var );
AVSC_DECLARE_FUNC( avs_take_clip );
AVSC_DECLARE_FUNC( avs_release_clip );

AVS_ScriptEnvironment *env; /* the actual script environment */

Expand Down
6 changes: 5 additions & 1 deletion src/avisynth_c/ff_vidsource.c
Expand Up @@ -627,5 +627,9 @@ AVS_Value FFVideoSource_create( AVS_ScriptEnvironment *env, const char *src, int
filter->fi->get_audio = get_audio;
filter->fi->get_parity = get_parity;
filter->fi->user_data = filter;
return clip_val( clip );

AVS_Value v = clip_val( clip );
ffms_avs_lib.avs_release_clip( clip );

return v;
}

0 comments on commit 34a4379

Please sign in to comment.