aboutsummaryrefslogtreecommitdiff
path: root/vpx/src/vpx_encoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'vpx/src/vpx_encoder.c')
-rw-r--r--vpx/src/vpx_encoder.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vpx/src/vpx_encoder.c b/vpx/src/vpx_encoder.c
index 846638fe5..0d6e48015 100644
--- a/vpx/src/vpx_encoder.c
+++ b/vpx/src/vpx_encoder.c
@@ -54,6 +54,10 @@ vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
res = ctx->iface->init(ctx, NULL);
if (res) {
+ // IMPORTANT: ctx->priv->err_detail must be null or point to a string
+ // that remains valid after ctx->priv is destroyed, such as a C string
+ // literal. This makes it safe to call vpx_codec_error_detail() after
+ // vpx_codec_enc_init_ver() failed.
ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
vpx_codec_destroy(ctx);
}