diff options
author | Vincent Sanders <vince@kyllikki.org> | 2017-10-15 13:43:35 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2017-10-15 13:51:05 +0100 |
commit | 71d303a1805b454395b9b2ed4d1007699b9d1314 (patch) | |
tree | 99176bb9155b9c49fea2028ed9747dfb5dae65f6 /src/surface/x.c | |
parent | 167205c109291aa1957ba64667efa12ce53bba5d (diff) | |
download | libnsfb-71d303a1805b454395b9b2ed4d1007699b9d1314.tar.gz libnsfb-71d303a1805b454395b9b2ed4d1007699b9d1314.tar.bz2 |
fix unchecked heap allocation returns
Alastair Hughes provided a patch in the bug tracker which I based this
implementation upon.
Closes: #2553
Diffstat (limited to 'src/surface/x.c')
-rw-r--r-- | src/surface/x.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/surface/x.c b/src/surface/x.c index f5ee01b..c011b38 100644 --- a/src/surface/x.c +++ b/src/surface/x.c @@ -846,10 +846,19 @@ static int x_initialise(nsfb_t *nsfb) mask, values); /* set size hits on window */ hints = xcb_alloc_size_hints(); - xcb_size_hints_set_max_size(hints, xstate->image->width, xstate->image->height); - xcb_size_hints_set_min_size(hints, xstate->image->width, xstate->image->height); - xcb_set_wm_size_hints(xstate->connection, xstate->window, WM_NORMAL_HINTS, hints); - xcb_free_size_hints(hints); + if (hints != NULL) { + xcb_size_hints_set_max_size(hints, + xstate->image->width, + xstate->image->height); + xcb_size_hints_set_min_size(hints, + xstate->image->width, + xstate->image->height); + xcb_set_wm_size_hints(xstate->connection, + xstate->window, + WM_NORMAL_HINTS, + hints); + xcb_free_size_hints(hints); + } /* create backing pixmap */ xstate->pmap = xcb_generate_id(xstate->connection); |