VirtualBox

Changeset 94385 in vbox


Ignore:
Timestamp:
Mar 28, 2022 4:55:20 PM (3 years ago)
Author:
vboxsync
Message:

Devices,SVGA: Fix some memory leaks in the OpenGL backend

Location:
trunk/src/VBox/Devices/Graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp

    r94063 r94385  
    12301230    pState->pszOtherExtensions = NULL;
    12311231
     1232    /* Free all leftover surface states. */
     1233    for (uint32_t i = 0; i < pState->cSurfaces; i++)
     1234    {
     1235        AssertPtr(pState->papSurfaces[i]);
     1236        RTMemFree(pState->papSurfaces[i]);
     1237        pState->papSurfaces[i] = NULL;
     1238    }
     1239
     1240    /* Destroy all leftover contexts. */
     1241    for (uint32_t i = 0; i < pState->cContexts; i++)
     1242    {
     1243        AssertPtr(pState->papContexts[i]);
     1244        RTMemFree(pState->papContexts[i]);
     1245        pState->papContexts[i] = NULL;
     1246    }
     1247
     1248    if (pState->papSurfaces)
     1249    {
     1250        RTMemFree(pState->papSurfaces);
     1251        pState->papSurfaces = NULL;
     1252    }
     1253
     1254    if (pState->papContexts)
     1255    {
     1256        RTMemFree(pState->papContexts);
     1257        pState->papContexts = NULL;
     1258    }
     1259
     1260    pThisCC->svga.p3dState = NULL;
     1261    RTMemFree(pState);
    12321262    return VINF_SUCCESS;
    12331263}
     
    34533483    GLXContext shareContext = pSharedCtx ? pSharedCtx->glxContext : NULL;
    34543484    pContext->glxContext = glXCreateContext(pState->display, vi, shareContext, GL_TRUE);
     3485    XFree(vi);
    34553486    AssertLogRelMsgReturn(pContext->glxContext, ("glXCreateContext failed"), VERR_INTERNAL_ERROR);
    34563487#endif
     
    75027533        {
    75037534            pShader = &pContext->paVertexShader[shid];
     7535            if (pContext->state.shidVertex == shid)
     7536            {
     7537                rc = ShaderSetVertexShader(pContext->pShaderContext, NULL);
     7538                AssertRC(rc);
     7539            }
     7540
    75047541            rc = ShaderDestroyVertexShader(pContext->pShaderContext, pShader->u.pVertexShader);
    75057542            AssertRC(rc);
     
    75137550        {
    75147551            pShader = &pContext->paPixelShader[shid];
     7552            if (pContext->state.shidPixel == shid)
     7553            {
     7554                ShaderSetPixelShader(pContext->pShaderContext, NULL);
     7555                AssertRC(rc);
     7556            }
     7557
    75157558            rc = ShaderDestroyPixelShader(pContext->pShaderContext, pShader->u.pPixelShader);
    75167559            AssertRC(rc);
  • trunk/src/VBox/Devices/Graphics/shaderlib/glsl_shader.c

    r83626 r94385  
    358358#endif
    359359    WDLOG(("\n"));
     360#ifdef VBOX
     361    HeapFree(GetProcessHeap(), 0, source);
     362#endif
    360363}
    361364
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette