Skip to content

Commit ef600d8

Browse files
authored
Check config is not null before dereferencing. (#1076)
1 parent e9875f1 commit ef600d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/api/api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,11 +761,11 @@ static z_result_t _z_session_rc_init(z_owned_session_t *zs, _z_id_t *zid) {
761761
z_result_t z_open(z_owned_session_t *zs, z_moved_config_t *config, const z_open_options_t *options) {
762762
_ZP_UNUSED(options);
763763

764-
_z_config_t *cfg = &config->_this._val;
765764
if (config == NULL) {
766765
_Z_ERROR("A valid config is missing.");
767766
_Z_ERROR_RETURN(_Z_ERR_GENERIC);
768767
}
768+
_z_config_t *cfg = &config->_this._val;
769769

770770
_z_id_t zid = _z_session_get_zid(cfg);
771771
if (!_z_id_check(zid)) {

0 commit comments

Comments
 (0)