diff options
author | David Robillard <d@drobilla.net> | 2012-05-11 22:34:48 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-11 22:34:48 +0000 |
commit | 53f8f81e2742876c8192b9429c4d4d20e9722b8b (patch) | |
tree | 667720fb6c5f8b1dba3a64b38eb1f030687b43a8 /pugl/pugl_win.cpp | |
parent | c5cf34948acafc7ecb22e481fd513c62111bbc0f (diff) | |
download | pugl-53f8f81e2742876c8192b9429c4d4d20e9722b8b.tar.gz pugl-53f8f81e2742876c8192b9429c4d4d20e9722b8b.tar.bz2 pugl-53f8f81e2742876c8192b9429c4d4d20e9722b8b.zip |
Fix memory leaks.
Diffstat (limited to 'pugl/pugl_win.cpp')
-rw-r--r-- | pugl/pugl_win.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/pugl/pugl_win.cpp b/pugl/pugl_win.cpp index cc69036..63d484f 100644 --- a/pugl/pugl_win.cpp +++ b/pugl/pugl_win.cpp @@ -24,7 +24,7 @@ #include "pugl_internal.h" -struct PuglPlatformDataImpl { +struct PuglInternalsImpl { HWND hwnd; HDC hdc; HGLRC hglrc; @@ -58,11 +58,15 @@ puglCreate(PuglNativeWindow parent, int height, bool resizable) { - PuglView* view = (PuglView*)calloc(1, sizeof(PuglView)); - - view->impl = (PuglPlatformData*)calloc(1, sizeof(PuglPlatformData)); + PuglView* view = (PuglView*)calloc(1, sizeof(PuglView)); + PuglInternals* impl = (PuglInternals*)calloc(1, sizeof(PuglInternals)); + if (!view || !impl) { + return NULL; + } - PuglPlatformData* impl = view->impl; + view->impl = impl; + view->width = width; + view->height = height; WNDCLASS wc; wc.style = CS_OWNDC; @@ -113,6 +117,7 @@ puglDestroy(PuglView* view) wglDeleteContext(view->impl->hglrc); ReleaseDC(view->impl->hwnd, view->impl->hdc); DestroyWindow(view->impl->hwnd); + free(view->impl); free(view); } |