Skip to content

Commit 80a520b

Browse files
committed
lol
1 parent 4e78408 commit 80a520b

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

lib/upipe-av/upipe_avfilter.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,6 @@ static int upipe_avfilt_avframe_from_uref_pic(struct upipe *upipe,
963963

964964
int err = upipe_av_set_frame_properties(upipe, frame, flow_def, uref);
965965
if (!ubase_check(err)) {
966-
uref_free(uref);
967966
return err;
968967
}
969968

@@ -984,7 +983,6 @@ static int upipe_avfilt_avframe_from_uref_pic(struct upipe *upipe,
984983

985984
inval:
986985
upipe_warn(upipe, "invalid buffer received");
987-
uref_free(uref);
988986
return UBASE_ERR_INVALID;
989987
}
990988

@@ -1055,7 +1053,6 @@ static int upipe_avfilt_avframe_from_uref_sound(struct upipe *upipe,
10551053

10561054
inval:
10571055
upipe_warn(upipe, "invalid buffer received");
1058-
uref_free(uref);
10591056
return UBASE_ERR_INVALID;
10601057
}
10611058

@@ -1073,7 +1070,10 @@ static int upipe_avfilt_avframe_from_uref(struct upipe *upipe,
10731070
struct uref *flow_def,
10741071
AVFrame *frame)
10751072
{
1076-
if (ubase_check(uref_flow_match_def(flow_def, UREF_PIC_FLOW_DEF)))
1073+
if (unlikely(!flow_def)) {
1074+
upipe_warn(upipe, "no flow def set");
1075+
return UBASE_ERR_INVALID;
1076+
} else if (ubase_check(uref_flow_match_def(flow_def, UREF_PIC_FLOW_DEF)))
10771077
return upipe_avfilt_avframe_from_uref_pic(
10781078
upipe, uref, flow_def, frame);
10791079
else if (ubase_check(uref_flow_match_def(flow_def, UREF_SOUND_FLOW_DEF)))
@@ -1129,6 +1129,7 @@ static void upipe_avfilt_sub_input(struct upipe *upipe,
11291129
frame);
11301130
if (unlikely(!ubase_check(ret))) {
11311131
upipe_throw_error(upipe, ret);
1132+
uref_free(uref);
11321133
av_frame_free(&frame);
11331134
return;
11341135
}
@@ -1930,11 +1931,13 @@ static void upipe_avfilt_input(struct upipe *upipe,
19301931
upipe_avfilt->uref = uref;
19311932

19321933
if (!ubase_check(ubuf_av_get_avframe(uref->ubuf, frame))) {
1933-
ret = upipe_avfilt_avframe_from_uref(upipe, uref_dup(uref),
1934+
struct uref *uref_tmp = uref_dup(uref);
1935+
ret = upipe_avfilt_avframe_from_uref(upipe, uref_tmp,
19341936
upipe_avfilt->flow_def_input,
19351937
frame);
19361938
if (!ubase_check(ret)) {
19371939
upipe_throw_error(upipe, ret);
1940+
uref_free(uref_tmp);
19381941
goto end;
19391942
}
19401943
}

tests/Makefile.am

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,13 @@ TESTS += \
259259
endif
260260
endif
261261

262+
if HAVE_AVFILTER
263+
check_PROGRAMS += \
264+
upipe_avfilter_test
265+
TESTS += \
266+
upipe_avfilter_test
267+
endif
268+
262269
if HAVE_GLX
263270
check_PROGRAMS += upipe_glx_sink_test
264271
endif
@@ -494,6 +501,8 @@ upipe_avcodec_test_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS)
494501
upipe_avcodec_test_LDADD = $(LDADD) -lev $(top_builddir)/lib/upump-ev/libupump_ev.la $(top_builddir)/lib/upipe-modules/libupipe_modules.la $(top_builddir)/lib/upipe-av/libupipe_av.la $(AVFORMAT_LIBS) -lpthread
495502
upipe_avcodec_decode_test_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS)
496503
upipe_avcodec_decode_test_LDADD = $(LDADD) -lev $(top_builddir)/lib/upump-ev/libupump_ev.la $(top_builddir)/lib/upipe-modules/libupipe_modules.la $(top_builddir)/lib/upipe-av/libupipe_av.la $(AVFORMAT_LIBS) -lpthread
504+
upipe_avfilter_test_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS)
505+
upipe_avfilter_test_LDADD = $(LDADD) -lev $(top_builddir)/lib/upump-ev/libupump_ev.la $(top_builddir)/lib/upipe-av/libupipe_av.la $(top_builddir)/lib/upipe-modules/libupipe_modules.la $(AVFORMAT_LIBS)
497506

498507
upipe_sws_test_CFLAGS = $(AM_CFLAGS) $(SWSCALE_CFLAGS)
499508
upipe_sws_test_LDADD = $(LDADD) $(SWSCALE_LIBS) $(top_builddir)/lib/upipe-swscale/libupipe_swscale.la

0 commit comments

Comments
 (0)