[ 
https://issues.apache.org/jira/browse/DISPATCH-1097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16571036#comment-16571036
 ] 

ASF GitHub Bot commented on DISPATCH-1097:
------------------------------------------

GitHub user ganeshmurthy opened a pull request:

    https://github.com/apache/qpid-dispatch/pull/354

    DISPATCH-1097 - Added code to fix issues reported by Coverity

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ganeshmurthy/qpid-dispatch DISPATCH-1097

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/qpid-dispatch/pull/354.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #354
    
----
commit 61b2e96bc62d1d750ba15580a5b69dc1c36c67d8
Author: Ganesh Murthy <gmurthy@...>
Date:   2018-08-07T01:36:01Z

    DISPATCH-1097 - Added code to fix issues reported by Coverity

----


> Fix Coverity issue on master branch
> -----------------------------------
>
>                 Key: DISPATCH-1097
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-1097
>             Project: Qpid Dispatch
>          Issue Type: Bug
>          Components: Container
>    Affects Versions: 1.2.0
>            Reporter: Ganesh Murthy
>            Assignee: Ganesh Murthy
>            Priority: Major
>             Fix For: 1.3.0
>
>
> {noformat}
> 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);
> ________________________________________________________________________________________________________
>     
>     
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to