]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_amqp] scan-build: Multiple dereferences of null pointer (loaded from variable... 462/head
authorDragos Oancea <dragos@signalwire.com>
Fri, 28 Feb 2020 13:45:28 +0000 (13:45 +0000)
committerDragos Oancea <dragos@signalwire.com>
Fri, 28 Feb 2020 13:45:28 +0000 (13:45 +0000)
src/mod/event_handlers/mod_amqp/mod_amqp_connection.c

index 2210ed032a84b9eb8df2ebddef92c6ae52cd2472..1da96328f9d02d42605096e7d4216fbabf75feb6 100644 (file)
@@ -150,20 +150,26 @@ switch_status_t mod_amqp_connection_open(mod_amqp_connection_t *connections, mod
                                                                                connection_attempt->password);
 
        if (mod_amqp_log_if_amqp_error(status, "Logging in")) {
-               mod_amqp_connection_close(*active);
-               *active = NULL;
+               if (active) {
+                       mod_amqp_connection_close(*active);
+                       *active = NULL;
+               }
                goto err;
        }
 
        // Open a channel (1). This is fairly standard
        amqp_channel_open(newConnection, 1);
        if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(newConnection), "Opening channel")) {
-               mod_amqp_connection_close(*active);
-               *active = NULL;
+               if (active) {
+                       mod_amqp_connection_close(*active);
+                       *active = NULL;
+               }
                goto err;
        }
 
-       (*active)->state = newConnection;
+       if (active) {
+               (*active)->state = newConnection;
+       }
 
        if (oldConnection) {
                amqp_destroy_connection(oldConnection);