Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check return value of _anjay_serv_get() for null #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/modules/server/anjay_mod_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,10 @@ AVS_LIST(const anjay_ssid_t) anjay_server_get_ssids(anjay_t *anjay_locked) {
ANJAY_MUTEX_LOCK(anjay, anjay_locked);
const anjay_dm_installed_object_t *server_obj =
_anjay_dm_find_object_by_oid(anjay, SERVER.oid);
server_repr_t *repr = _anjay_serv_get(*server_obj);
if (_anjay_dm_transaction_object_included(anjay, server_obj)) {
server_repr_t *repr = server_obj ? _anjay_serv_get(*server_obj) : NULL;
if (!repr) {
server_log(ERROR, _("Server object is not registered"));
} else if (_anjay_dm_transaction_object_included(anjay, server_obj)) {
source = repr->saved_instances;
} else {
source = repr->instances;
Expand Down Expand Up @@ -782,8 +784,10 @@ int anjay_server_object_set_lifetime(anjay_t *anjay_locked,
ANJAY_MUTEX_LOCK(anjay, anjay_locked);
const anjay_dm_installed_object_t *server_obj =
_anjay_dm_find_object_by_oid(anjay, SERVER.oid);
server_repr_t *repr = _anjay_serv_get(*server_obj);
if (repr->saved_instances) {
server_repr_t *repr = server_obj ? _anjay_serv_get(*server_obj) : NULL;
if (!repr) {
server_log(ERROR, _("Server object is not registered"));
} else if (repr->saved_instances) {
server_log(ERROR, _("cannot set Lifetime while some transaction is "
"started on the Server Object"));
} else {
Expand Down