<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="en-001" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi<br>
Thank you for your help<br>
I tried your code but  it doesn’t leak memory<br>
My code leaks memory only when these 2 lines are used<br>
</span><span lang="EN-US">                                err = av_hwdevice_ctx_create_derived(&encoderContext->hw_device_ctx, AV_HWDEVICE_TYPE_QSV, hardwareDeviceContext, 0);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">                                err = av_hwframe_ctx_create_derived(&encoderContext->hw_frames_ctx, AV_PIX_FMT_QSV, encoderContext->hw_device_ctx, hardwareFrameContext, 0);<o:p></o:p></span></p>
<p class="MsoNormal">Best regards</p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>