diff options
author | Ran Benita <ran234@gmail.com> | 2012-10-29 01:00:27 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2012-10-29 01:20:04 +0200 |
commit | 7261f404d201b157dc0ce1ae0386fd74f3a128a7 (patch) | |
tree | fbd0cf78ce7ace10dc1f79042163be0ab0b3528a /src/state.c | |
parent | a51ee70419cf492a46020123294c7f708c81070d (diff) | |
download | xorg-lib-libxkbcommon-7261f404d201b157dc0ce1ae0386fd74f3a128a7.tar.gz |
state, context: allow passing NULL to *_unref()
For error handling code, it's nice to be able to pass NULL to these
function without worrying about segfaults ensuing. free() sets the
precedent here.
Also document this fact.
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/state.c')
-rw-r--r-- | src/state.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/state.c b/src/state.c index eaa1f10..48b2132 100644 --- a/src/state.c +++ b/src/state.c @@ -583,7 +583,7 @@ xkb_state_ref(struct xkb_state *state) XKB_EXPORT void xkb_state_unref(struct xkb_state *state) { - if (--state->refcnt > 0) + if (!state || --state->refcnt > 0) return; xkb_keymap_unref(state->keymap); |