Merge pull request #462 from dragos-oancea/mod_amqp-nullptrs
[mod_amqp] scan-build: Multiple dereference of null pointer (loaded from variable 'active')
This commit is contained in:
commit
bd3982d607
|
@ -150,20 +150,26 @@ switch_status_t mod_amqp_connection_open(mod_amqp_connection_t *connections, mod
|
||||||
connection_attempt->password);
|
connection_attempt->password);
|
||||||
|
|
||||||
if (mod_amqp_log_if_amqp_error(status, "Logging in")) {
|
if (mod_amqp_log_if_amqp_error(status, "Logging in")) {
|
||||||
mod_amqp_connection_close(*active);
|
if (active) {
|
||||||
*active = NULL;
|
mod_amqp_connection_close(*active);
|
||||||
|
*active = NULL;
|
||||||
|
}
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open a channel (1). This is fairly standard
|
// Open a channel (1). This is fairly standard
|
||||||
amqp_channel_open(newConnection, 1);
|
amqp_channel_open(newConnection, 1);
|
||||||
if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(newConnection), "Opening channel")) {
|
if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(newConnection), "Opening channel")) {
|
||||||
mod_amqp_connection_close(*active);
|
if (active) {
|
||||||
*active = NULL;
|
mod_amqp_connection_close(*active);
|
||||||
|
*active = NULL;
|
||||||
|
}
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*active)->state = newConnection;
|
if (active) {
|
||||||
|
(*active)->state = newConnection;
|
||||||
|
}
|
||||||
|
|
||||||
if (oldConnection) {
|
if (oldConnection) {
|
||||||
amqp_destroy_connection(oldConnection);
|
amqp_destroy_connection(oldConnection);
|
||||||
|
|
Loading…
Reference in New Issue