diff options
author | defanor <defanor@uberspace.net> | 2023-06-09 14:43:15 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2023-06-09 14:43:15 +0300 |
commit | 2d4110996bea53a9568b750d00d4dcdcc3907bc6 (patch) | |
tree | c0501e57847a0a9b1b415c17f2a6816a40eae3c2 /src/rexmpp_jingle.c | |
parent | 122b13ec955deb718aca280112584b645c9caea0 (diff) |
Avoid direct strdup of values returned by rexmpp_xml_find_attr_val
Better to check those to not be NULL first.
Diffstat (limited to 'src/rexmpp_jingle.c')
-rw-r--r-- | src/rexmpp_jingle.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rexmpp_jingle.c b/src/rexmpp_jingle.c index 573c193..11393c0 100644 --- a/src/rexmpp_jingle.c +++ b/src/rexmpp_jingle.c @@ -1511,7 +1511,7 @@ int rexmpp_jingle_iq (rexmpp_t *s, rexmpp_xml_t *elem) { "description"); if (file_description != NULL && ibb_transport != NULL) { - char *ibb_sid = strdup(rexmpp_xml_find_attr_val(ibb_transport, "sid")); + const char *ibb_sid = rexmpp_xml_find_attr_val(ibb_transport, "sid"); if (ibb_sid != NULL) { rexmpp_log(s, LOG_DEBUG, "Jingle session-initiate from %s, sid %s, ibb sid %s", @@ -1521,7 +1521,7 @@ int rexmpp_jingle_iq (rexmpp_t *s, rexmpp_xml_t *elem) { REXMPP_JINGLE_SESSION_FILE, 0); if (sess != NULL) { sess->initiate = rexmpp_xml_clone(jingle); - sess->ibb_sid = ibb_sid; + sess->ibb_sid = strdup(ibb_sid); } else { rexmpp_jingle_session_terminate(s, sid, rexmpp_xml_new_elem("failed-transport", |