Uploaded image for project: 'Qpid Dispatch'
  1. Qpid Dispatch
  2. DISPATCH-1097

Fix Coverity issue on master branch

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.0
    • 1.3.0
    • Container
    • None

    Description

      5 new defect(s) introduced to Apache Qpid dispatch-router found with Coverity Scan.
      1 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.
      
      New defect(s) Reported-by: Coverity Scan
      Showing 5 of 5 defect(s)
      
      
      ** CID 308513:  Null pointer dereferences  (FORWARD_NULL)
      /home/kgiusti/work/qpid-dispatch/src/router_core/route_control.c: 245 in qdr_auto_link_activate_CT()
      
      
      ________________________________________________________________________________________________________
      *** CID 308513:  Null pointer dereferences  (FORWARD_NULL)
      /home/kgiusti/work/qpid-dispatch/src/router_core/route_control.c: 245 in qdr_auto_link_activate_CT()
      239                 term = target;
      240     
      241             key = (const char*) qd_hash_key_by_handle(al->addr->hash_handle);
      242             if (key || al->external_addr) {
      243                 if (al->external_addr) {
      244                     qdr_terminus_set_address(term, al->external_addr);
      >>>     CID 308513:  Null pointer dereferences  (FORWARD_NULL)
      >>>     Dereferencing null pointer "key".
      245                     al->internal_addr = &key[2];
      246                 } else
      247                     qdr_terminus_set_address(term, &key[2]); // truncate the "Mp" annotation (where p = phase)
      248                 al->link = qdr_create_link_CT(core, conn, QD_LINK_ENDPOINT, al->dir, source, target);
      249                 al->link->auto_link = al;
      250                 al->state = QDR_AUTO_LINK_STATE_ATTACHING;
      
      ** CID 308512:    (RESOURCE_LEAK)
      /home/kgiusti/work/qpid-dispatch/src/router_core/route_control.c: 252 in qdr_auto_link_activate_CT()
      /home/kgiusti/work/qpid-dispatch/src/router_core/route_control.c: 252 in qdr_auto_link_activate_CT()
      
      
      ________________________________________________________________________________________________________
      *** CID 308512:    (RESOURCE_LEAK)
      /home/kgiusti/work/qpid-dispatch/src/router_core/route_control.c: 252 in qdr_auto_link_activate_CT()
      246                 } else
      247                     qdr_terminus_set_address(term, &key[2]); // truncate the "Mp" annotation (where p = phase)
      248                 al->link = qdr_create_link_CT(core, conn, QD_LINK_ENDPOINT, al->dir, source, target);
      249                 al->link->auto_link = al;
      250                 al->state = QDR_AUTO_LINK_STATE_ATTACHING;
      251             }
      >>>     CID 308512:    (RESOURCE_LEAK)
      >>>     Variable "term" going out of scope leaks the storage it points to.
      252         }
      253     }
      254     
      255     
      256     static void qdr_auto_link_deactivate_CT(qdr_core_t *core, qdr_auto_link_t *al, qdr_connection_t *conn)
      257     {
      /home/kgiusti/work/qpid-dispatch/src/router_core/route_control.c: 252 in qdr_auto_link_activate_CT()
      246                 } else
      247                     qdr_terminus_set_address(term, &key[2]); // truncate the "Mp" annotation (where p = phase)
      248                 al->link = qdr_create_link_CT(core, conn, QD_LINK_ENDPOINT, al->dir, source, target);
      249                 al->link->auto_link = al;
      250                 al->state = QDR_AUTO_LINK_STATE_ATTACHING;
      251             }
      >>>     CID 308512:    (RESOURCE_LEAK)
      >>>     Variable "source" going out of scope leaks the storage it points to.
      252         }
      253     }
      254     
      255     
      256     static void qdr_auto_link_deactivate_CT(qdr_core_t *core, qdr_auto_link_t *al, qdr_connection_t *conn)
      257     {
      
      ** CID 308511:    (USE_AFTER_FREE)
      /home/kgiusti/work/qpid-dispatch/src/server.c: 978 in thread_run()
      /home/kgiusti/work/qpid-dispatch/src/server.c: 978 in thread_run()
      
      
      ________________________________________________________________________________________________________
      *** CID 308511:    (USE_AFTER_FREE)
      /home/kgiusti/work/qpid-dispatch/src/server.c: 978 in thread_run()
      972                     pn_conn = conn;
      973                 assert(pn_conn == conn);
      974     
      975                 if (!qd_conn)
      976                     qd_conn = !!pn_conn ? (qd_connection_t*) pn_connection_get_context(pn_conn) : 0;
      977     
      >>>     CID 308511:    (USE_AFTER_FREE)
      >>>     Calling "handle" frees pointer "qd_conn" which has already been freed.
      978                 running = handle(qd_server, e, conn, qd_conn);
      979             }
      980     
      981             //
      982             // Notify the container that the batch is complete so it can do after-batch
      983             // processing.
      /home/kgiusti/work/qpid-dispatch/src/server.c: 978 in thread_run()
      972                     pn_conn = conn;
      973                 assert(pn_conn == conn);
      974     
      975                 if (!qd_conn)
      976                     qd_conn = !!pn_conn ? (qd_connection_t*) pn_connection_get_context(pn_conn) : 0;
      977     
      >>>     CID 308511:    (USE_AFTER_FREE)
      >>>     Passing freed pointer "qd_conn" as an argument to "handle".
      978                 running = handle(qd_server, e, conn, qd_conn);
      979             }
      980     
      981             //
      982             // Notify the container that the batch is complete so it can do after-batch
      983             // processing.
      /home/kgiusti/work/qpid-dispatch/src/server.c: 986 in thread_run()
      980     
      981             //
      982             // Notify the container that the batch is complete so it can do after-batch
      983             // processing.
      984             //
      985             if (qd_conn)
      >>>     CID 308511:    (USE_AFTER_FREE)
      >>>     Calling "qd_conn_event_batch_complete" dereferences freed pointer "qd_conn".
      986                 qd_conn_event_batch_complete(qd_server->container, qd_conn);
      987     
      988             pn_proactor_done(qd_server->proactor, events);
      989         }
      990         return NULL;
      991     }
      
      ** CID 308510:    (RESOURCE_LEAK)
      /home/kgiusti/work/qpid-dispatch/src/router_core/route_control.c: 252 in qdr_auto_link_activate_CT()
      /home/kgiusti/work/qpid-dispatch/src/router_core/route_control.c: 252 in qdr_auto_link_activate_CT()
      
      
      ________________________________________________________________________________________________________
      *** CID 308510:    (RESOURCE_LEAK)
      /home/kgiusti/work/qpid-dispatch/src/router_core/route_control.c: 252 in qdr_auto_link_activate_CT()
      246                 } else
      247                     qdr_terminus_set_address(term, &key[2]); // truncate the "Mp" annotation (where p = phase)
      248                 al->link = qdr_create_link_CT(core, conn, QD_LINK_ENDPOINT, al->dir, source, target);
      249                 al->link->auto_link = al;
      250                 al->state = QDR_AUTO_LINK_STATE_ATTACHING;
      251             }
      >>>     CID 308510:    (RESOURCE_LEAK)
      >>>     Variable "term" going out of scope leaks the storage it points to.
      252         }
      253     }
      254     
      255     
      256     static void qdr_auto_link_deactivate_CT(qdr_core_t *core, qdr_auto_link_t *al, qdr_connection_t *conn)
      257     {
      /home/kgiusti/work/qpid-dispatch/src/router_core/route_control.c: 252 in qdr_auto_link_activate_CT()
      246                 } else
      247                     qdr_terminus_set_address(term, &key[2]); // truncate the "Mp" annotation (where p = phase)
      248                 al->link = qdr_create_link_CT(core, conn, QD_LINK_ENDPOINT, al->dir, source, target);
      249                 al->link->auto_link = al;
      250                 al->state = QDR_AUTO_LINK_STATE_ATTACHING;
      251             }
      >>>     CID 308510:    (RESOURCE_LEAK)
      >>>     Variable "target" going out of scope leaks the storage it points to.
      252         }
      253     }
      254     
      255     
      256     static void qdr_auto_link_deactivate_CT(qdr_core_t *core, qdr_auto_link_t *al, qdr_connection_t *conn)
      257     {
      
      ** CID 308509:  Resource leaks  (RESOURCE_LEAK)
      /home/kgiusti/work/qpid-dispatch/src/router_node.c: 1080 in AMQP_opened_handler()
      
      
      ________________________________________________________________________________________________________
      *** CID 308509:  Resource leaks  (RESOURCE_LEAK)
      /home/kgiusti/work/qpid-dispatch/src/router_node.c: 1080 in AMQP_opened_handler()
      1074                                             free(item->host);
      1075                                             free(item->port);
      1076                                             free(item->hostname);
      1077                                             free(item->host_port);
      1078                                             free(item);
      1079                                     }
      >>>     CID 308509:  Resource leaks  (RESOURCE_LEAK)
      >>>     Variable "item" going out of scope leaks the storage it points to.
      1080                                 }
      1081                                 pn_data_exit(props);
      1082                             }
      1083                         } // list_num_items > 0
      1084                         else {
      1085                             save_original_and_current_conn_info(conn);
      
      
      ________________________________________________________________________________________________________
      
          
          
      

      Attachments

        Issue Links

          Activity

            People

              gmurthy Ganesh Murthy
              gmurthy Ganesh Murthy
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: