VirtualBox

Ignore:
Timestamp:
Jun 26, 2009 1:56:25 PM (15 years ago)
Author:
vboxsync
Message:

crOpenGL: fix memory leak when using VBOs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_bufferobject.c

    r15532 r20975  
    3737
    3838#ifdef IN_GUEST
     39    b->retainBufferData = GL_TRUE;
     40#else
    3941    b->retainBufferData = GL_FALSE;
    40 #else
    41     b->retainBufferData = GL_TRUE;
    4242#endif
    4343
     
    5151
    5252
     53static void crStateFreeBufferObject(void *data)
     54{
     55    CRBufferObject *pObj = (CRBufferObject *)data;
     56    if (pObj->data) crFree(pObj->data);
     57    crFree(pObj);
     58}
     59
    5360void crStateBufferObjectDestroy (CRContext *ctx)
    5461{
    5562    CRBufferObjectState *b = &ctx->bufferobject;
    56     crFreeHashtable(b->buffers, crFree);
     63    crFreeHashtable(b->buffers, crStateFreeBufferObject);
    5764    crFree(b->nullBuffer);
    5865}
     
    119126
    120127    if (oldObj->refCount <= 0) {
    121         crHashtableDelete(b->buffers, (unsigned long) oldObj->name, crFree);
     128        /*we shouldn't reach this point*/
     129        CRASSERT(false);
     130        crHashtableDelete(b->buffers, (unsigned long) oldObj->name, crStateFreeBufferObject);
    122131    }
    123132}
     
    165174                /* XXX check bindings with the vertex arrays */
    166175
    167                 crHashtableDelete(b->buffers, buffers[i], crFree);
     176                crHashtableDelete(b->buffers, buffers[i], crStateFreeBufferObject);
    168177            }
    169178        }
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