diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2013-10-09 11:46:36 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2013-10-09 11:46:36 +0000 |
| commit | e77c0cd47c14cf0f76e79139141833277cda510a (patch) | |
| tree | feaea882e2b696d0b9e1acb0dbb71f1185fd81f0 /src | |
| parent | 83e43296950c225210f42a74c056311be50f16c2 (diff) | |
Small addition to fix for STR #2985 - see comment in source file.
Fixes a small potential of another leak.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9998 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_x.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index ced8f27c4..660a0a929 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -821,16 +821,19 @@ void fl_sendClientMessage(Window window, Atom message, } -/* - Get window property value (32 bit format) +/* + Get window property value (32 bit format) Returns zero on success, -1 on error 'data' should be freed with XFree() using this pattern: - + unsigned long *data = 0; if (0 == get_xwinprop(....., &nitems, &data) ) { ..success.. } else { ..fail.. } if ( data ) { XFree(data); data=0; } + + Note: 'data' can be non-zero, even if the return value is -1 (error) and + should hence be XFree'd *after* the if/else statement, as described above. */ static int get_xwinprop(Window wnd, Atom prop, long max_length, unsigned long *nitems, unsigned long **data) { @@ -1907,9 +1910,9 @@ int Fl_X::ewmh_supported() { if (0 == get_xwinprop(child, fl_NET_SUPPORTING_WM_CHECK, 64, &nitems, &words) ) { if ( nitems == 1) result = (child == words[0]); - if ( words ) { XFree(words); words = 0; } } } + if ( words ) { XFree(words); words = 0; } } return result; |
