[
https://issues.apache.org/jira/browse/TS-4089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15065438#comment-15065438
]
ASF GitHub Bot commented on TS-4089:
------------------------------------
GitHub user jrushf1239k opened a pull request:
https://github.com/apache/trafficserver/pull/390
TS-4089: Fixed coverity issues in parent selection.
Updated the ParentConfigParams destructor to free the memory pointed at by
policy and corrected the null pointer issue in ParentConsistentHash.cc:158.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jrushf1239k/trafficserver ts4089
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafficserver/pull/390.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 #390
----
commit d5438ddd112b24515d68fd2dd1a2fa0b1e645674
Author: John J. Rushford <[email protected]>
Date: 2015-12-19T17:09:21Z
TS-4089: Fixed coverity issues in parent selection.
----
> CID 1343608, 1343607: Parent selection Coverity issues
> ------------------------------------------------------
>
> Key: TS-4089
> URL: https://issues.apache.org/jira/browse/TS-4089
> Project: Traffic Server
> Issue Type: Bug
> Components: Parent Proxy
> Reporter: Leif Hedstrom
> Assignee: John Rushford
> Labels: Coverity
> Fix For: 6.1.0
>
>
> This is from the refactoring I'm pretty sure.
> {code}
> ** CID 1343608: Resource leaks (CTOR_DTOR_LEAK)
> /proxy/ParentSelection.cc: 95 in
> ParentConfigParams::ParentConfigParams(ControlMatcher<ParentRecord,
> ParentResult> *)()
> ________________________________________________________________________________________________________
> *** CID 1343608: Resource leaks (CTOR_DTOR_LEAK)
> /proxy/ParentSelection.cc: 95 in
> ParentConfigParams::ParentConfigParams(ControlMatcher<ParentRecord,
> ParentResult> *)()
> 89
> 90 ParentConfigParams::ParentConfigParams(P_table *_parent_table)
> 91 {
> 92 char *default_val = NULL;
> 93 parent_table = _parent_table;
> 94
> CID 1343608: Resource leaks (CTOR_DTOR_LEAK)
> The constructor allocates field "policy" of "ParentConfigParams" but the
> destructor and whatever functions it calls do not free it.
> 95 policy = new ParentSelectionPolicy();
> 96
> 97 // Handle default parent
> 98 PARENT_ReadConfigStringAlloc(default_val, default_var);
> 99 DefaultParent = createDefaultParent(default_val);
> 100 ats_free(default_val);
> ** CID 1343607: Null pointer dereferences (FORWARD_NULL)
> /proxy/ParentConsistentHash.cc: 158 in
> ParentConsistentHash::selectParent(const ParentSelectionPolicy *, bool,
> ParentResult *, RequestData *)()
> ________________________________________________________________________________________________________
> *** CID 1343607: Null pointer dereferences (FORWARD_NULL)
> /proxy/ParentConsistentHash.cc: 158 in
> ParentConsistentHash::selectParent(const ParentSelectionPolicy *, bool,
> ParentResult *, RequestData *)()
> 152 Debug("parent_select", "Parent.failedAt = %u, retry = %u,
> xact_start = %u", (unsigned int)pRec->failedAt,
> 153 (unsigned int)policy->ParentRetryTime, (unsigned
> int)request_info->xact_start);
> 154 if ((pRec->failedAt + policy->ParentRetryTime) <
> request_info->xact_start) {
> 155 parentRetry = true;
> 156 // make sure that the proper state is recorded in the
> result structure
> 157 // so that markParentUp() finds the proper record.
> CID 1343607: Null pointer dereferences (FORWARD_NULL)
> Dereferencing null pointer "prtmp".
> 158 result->last_parent = prtmp->idx;
> 159 result->last_lookup = last_lookup;
> 160 result->retry = parentRetry;
> 161 result->r = PARENT_SPECIFIED;
> 162 markParentUp(result);
> 163 Debug("parent_select", "Down parent %s is now retryable,
> marked it available.", pRec->hostname);
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)