diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index ac1e2c9d67fa84a62d9da4aa24dd3755ceec0e86..9ffc7189ce5b30b76de025175ea5ba781f983d78 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -209,6 +209,7 @@ AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
     ctx->device_ref = device_ref;
     ctx->device_ctx = device_ctx;
     ctx->format     = AV_PIX_FMT_NONE;
+    ctx->sw_format  = AV_PIX_FMT_NONE;
 
     ctx->internal->hw_type = hw_type;