free() is NULL safe.  The check was superfluous in the first place.  Just do
```
free(m_keybuf);
m_keybuf = NULL;
```