Skip to content
  • Jon Turney's avatar
    glx: Fix crash when a client exits without deleting GL contexts · bc71081f
    Jon Turney authored
    
    
    With the previous patches applied, we now have crash due to use-after-free when
    a client exits without deleting all it's GL contexts
    
    On client exit, CloseDownClient first calls glxClientCallback() with
    ClientStateGone, which calls __glXFreeContext() directly.
    
    Subsequently CloseDownClient() frees all the clients resources, which leads to
    ContextGone() being called for a context resource where the context has already
    been freed.
    
    Fix this by modifiying glxClientCallback() to free the context resource.
    
    Also make __glXFreeContext() static, as calling it directly leads to this
    problem, instead the context resource should be released.
    
    With the previous patches applied, this can be demonstrated with e.g. glxinfo,
    which doesn't delete it's context before exit.
    
    Signed-off-by: default avatarJon TURNEY <jon.turney@dronecode.org.uk>
    Reviewed-by: default avatarAdam Jackson <ajax@redhat.com>
    bc71081f