You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Dutch T. Meyer (JIRA)" <ji...@apache.org> on 2014/05/13 20:20:15 UTC

[jira] [Updated] (ZOOKEEPER-1836) addrvec_next() fails to set next parameter if addrvec_hasnext() returns false

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dutch T. Meyer updated ZOOKEEPER-1836:
--------------------------------------

    Attachment: ZOOKEEPER-1836.patch

Quick fix to an obvious code defect - unit test seems unnecessary to me.

> addrvec_next() fails to set next parameter if addrvec_hasnext() returns false
> -----------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1836
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1836
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: c client
>            Reporter: Dutch T. Meyer
>            Priority: Trivial
>         Attachments: ZOOKEEPER-1836.patch
>
>
> There is a relatively innocuous but useless pointer assignment in
> addrvec_next():
> 195	void addrvec_next(addrvec_t *avec, struct sockaddr_storage *next)
> ....
> 203	    if (!addrvec_hasnext(avec))
> 204	    {
> 205	        next = NULL;
> 206	        return;
> That assignment on (205) has no point, as next is a local variable lost upon function return.  Likely this should be a memset to zero out the actual parameter.



--
This message was sent by Atlassian JIRA
(v6.2#6252)