Skip to content

Commit c3926ca

Browse files
authored
Merge pull request #3 from freeswitch/develop
Fixed a couple of scan-build errors
2 parents ba8e9cd + a250313 commit c3926ca

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

mosquitto_mosq.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ switch_status_t mosq_connect(mosquitto_connection_t *connection)
10331033
unsigned port;
10341034

10351035
if (!connection) {
1036-
log(SWITCH_LOG_ERROR, "mosq_connect() profile %s failed because connection name is NULL\n", connection->profile_name);
1036+
log(SWITCH_LOG_ERROR, "mosq_connect() failed because connection name is NULL\n");
10371037
return SWITCH_STATUS_GENERR;
10381038
}
10391039

@@ -1130,7 +1130,7 @@ switch_status_t mosq_loop_stop(mosquitto_connection_t *connection, switch_bool_t
11301130
* This is part of the threaded client interface.
11311131
* Call this once to stop the network thread previously created with mosquitto_loop_start.
11321132
* This call will block until the network thread finishes.
1133-
* For the network thread to end, you must have previously called mosquitto_disconnect or have set the
1133+
* For the network thread to end, you must have previously called mosquitto_disconnect or have set the
11341134
* force parameter to true.
11351135
*
11361136
* mosq A valid mosquitto instance.
@@ -1256,13 +1256,11 @@ switch_status_t mosq_new(mosquitto_profile_t *profile, mosquitto_connection_t *c
12561256
userdata->profile = profile;
12571257
userdata->connection = connection;
12581258

1259-
if (connection->client_id == NULL) {
1260-
if (connection->clean_session == SWITCH_FALSE) {
1261-
log(SWITCH_LOG_INFO, "mosquitto_new() profile %s connection %s called with NULL client_id, forcing clean_session to TRUE\n", profile->name, connection->name);
1262-
clean_session = SWITCH_TRUE;
1263-
}
1264-
}
1265-
clean_session = connection->clean_session;
1259+
if (connection->client_id != NULL) {
1260+
clean_session = connection->clean_session;
1261+
} else {
1262+
log(SWITCH_LOG_INFO, "mosquitto_new() profile %s connection %s called with NULL client_id, forcing clean_session to TRUE\n", profile->name, connection->name);
1263+
}
12661264

12671265
log(SWITCH_LOG_DEBUG, "mosquitto_new() being called with profile %s connection %s clean_session %s client_id %s\n", profile->name, connection->name, clean_session ? "True" : "False", connection->client_id);
12681266

@@ -1297,7 +1295,7 @@ switch_status_t mosq_new(mosquitto_profile_t *profile, mosquitto_connection_t *c
12971295
/**
12981296
* @brief This routine frees memory associated with a mosquitto client instance
12991297
*
1300-
* @details This routine frees memowy associated with a mosquitto client instance and also frees memory allocated
1298+
* @details This routine frees memowy associated with a mosquitto client instance and also frees memory allocated
13011299
* for the userdata structure associated with this client instance
13021300
*
13031301
* @param[in] *mosq Pointer to the mosquitto client instance
@@ -1320,7 +1318,7 @@ switch_status_t mosq_destroy(mosquitto_connection_t *connection)
13201318
log(SWITCH_LOG_ERROR, "mosq_destroy() called with NULL mosquitto client instance\n");
13211319
return SWITCH_STATUS_GENERR;
13221320
}
1323-
1321+
13241322
#if LIBMOSQUITTO_VERSION_NUMBER >= 1006008
13251323
userdata = mosquitto_userdata(connection->mosq);
13261324
if (!userdata) {
@@ -1536,7 +1534,7 @@ switch_status_t mosq_startup(void)
15361534
} else {
15371535
status = initialize_profiles();
15381536
}
1539-
1537+
15401538
return status;
15411539
}
15421540

0 commit comments

Comments
 (0)