diff --git a/ffmpeg.c b/ffmpeg.c
index faeb2f5c3a57c1cf5c0018bce7eea445baaa6894..2d979c9160ad2c79657867485e5965860ca9796f 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1172,8 +1172,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
     AVFilterContext *first_filter = in->filter_ctx;
     AVFilter *filter = avfilter_get_by_name("buffer");
     InputStream *ist = ifilter->ist;
-    AVRational tb = ist->framerate.num ? (AVRational){ist->framerate.den,
-                                                      ist->framerate.num} :
+    AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) :
                                          ist->st->time_base;
     AVRational fr = ist->framerate.num ? ist->framerate :
                                          ist->st->r_frame_rate;
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index 6ef2db2299a93b727f2059ea12895c1c7100de62..791e66af7b17f8a5742d64476d12edf07b563ca8 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -62,7 +62,8 @@ static int decode_frame(AVCodecContext *avctx,
     AVFrame *const p = &s->picture;
     uint8_t *ptr;
 
-    int magic_num, offset, endian;
+    unsigned int offset;
+    int magic_num, endian;
     int x, y;
     int w, h, stride, bits_per_color, descriptor, elements, target_packet_size, source_packet_size;
 
diff --git a/libavcodec/x86/h264_idct.asm b/libavcodec/x86/h264_idct.asm
index da045f71e26b838c01cfe11de06b481829526d1d..edd603b79359b0b60e0486bcb75a4a9b3e87f3e5 100644
--- a/libavcodec/x86/h264_idct.asm
+++ b/libavcodec/x86/h264_idct.asm
@@ -704,7 +704,7 @@ h264_idct_dc_add8_mmx2:
 ALIGN 16
 INIT_XMM
 ; r0 = uint8_t *dst (clobbered), r2 = int16_t *block, r3 = int stride
-x264_add8x4_idct_sse2:
+h264_add8x4_idct_sse2:
     movq   m0, [r2+ 0]
     movq   m1, [r2+ 8]
     movq   m2, [r2+16]
@@ -733,7 +733,7 @@ x264_add8x4_idct_sse2:
 %else
     add         r0, r0m
 %endif
-    call        x264_add8x4_idct_sse2
+    call        h264_add8x4_idct_sse2
 .cycle%1end
 %if %1 < 7
     add         r2, 64
@@ -768,7 +768,7 @@ cglobal h264_idct_add16_8_sse2, 5, 5 + ARCH_X86_64, 8
 %else
     add         r0, r0m
 %endif
-    call        x264_add8x4_idct_sse2
+    call        h264_add8x4_idct_sse2
     jmp .cycle%1end
 .try%1dc
     movsx       r0, word [r2   ]
@@ -815,7 +815,7 @@ cglobal h264_idct_add16intra_8_sse2, 5, 7 + ARCH_X86_64, 8
     mov         r0, [r0]
     add         r0, dword [r1+(%1&1)*8+64*(1+(%1>>1))]
 %endif
-    call        x264_add8x4_idct_sse2
+    call        h264_add8x4_idct_sse2
     jmp .cycle%1end
 .try%1dc
     movsx       r0, word [r2   ]
diff --git a/libavfilter/audio.c b/libavfilter/audio.c
index f3eebbfdaebb46328b628cc8dc2af47dffe45d89..1a201e608bc55c7fac6ef407d39bb5117fc36db0 100644
--- a/libavfilter/audio.c
+++ b/libavfilter/audio.c
@@ -178,6 +178,10 @@ int ff_filter_samples_framed(AVFilterLink *link, AVFilterBufferRef *samplesref)
 
         buf_out = ff_default_get_audio_buffer(link, dst->min_perms,
                                               samplesref->audio->nb_samples);
+        if (!buf_out) {
+            avfilter_unref_buffer(samplesref);
+            return AVERROR(ENOMEM);
+        }
         buf_out->pts                = samplesref->pts;
         buf_out->audio->sample_rate = samplesref->audio->sample_rate;
 
diff --git a/libavutil/rational.h b/libavutil/rational.h
index 8c2bdb552901cb6e01caa6c3d061fe3fb8337475..417e29e5779fff362386781c7236db0f265854c5 100644
--- a/libavutil/rational.h
+++ b/libavutil/rational.h
@@ -114,6 +114,17 @@ AVRational av_add_q(AVRational b, AVRational c) av_const;
  */
 AVRational av_sub_q(AVRational b, AVRational c) av_const;
 
+/**
+ * Invert a rational.
+ * @param q value
+ * @return 1 / q
+ */
+static av_always_inline AVRational av_inv_q(AVRational q)
+{
+    AVRational r = { q.den, q.num };
+    return r;
+}
+
 /**
  * Convert a double precision floating point number to a rational.
  * inf is expressed as {1,0} or {-1,0} depending on the sign.