pcp
[Top] [All Lists]

Re: Python code vs local: host connections

To: Nathan Scott <nathans@xxxxxxxxxx>
Subject: Re: Python code vs local: host connections
From: fche@xxxxxxxxxx (Frank Ch. Eigler)
Date: Tue, 17 Sep 2013 09:53:08 -0400
Cc: Dave Brolley <brolley@xxxxxxxxxx>, Stan Cox <scox@xxxxxxxxxx>, pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <503959600.22684715.1379397714223.JavaMail.root@xxxxxxxxxx> (Nathan Scott's message of "Tue, 17 Sep 2013 02:01:54 -0400 (EDT)")
References: <100234653.22684536.1379397669579.JavaMail.root@xxxxxxxxxx> <503959600.22684715.1379397714223.JavaMail.root@xxxxxxxxxx>
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)
Nathan Scott <nathans@xxxxxxxxxx> writes:

> [...]

It looks good to me, except:

> -    def pmGetContextHostName( self ):
> +    def pmGetContextHostName(self):
> [...]
> -        status = LIBPCP.pmGetContextHostName(self.ctx)
> -        if status < 0:
> -            raise pmErr, status
> +        hp = c_char_p()
> +        hp = LIBPCP.pmGetContextHostName(self.ctx)
> +        hostname = hp
> +        LIBC.free(hp)
>          return status

While the new implementation of pmGetContextHostName does a strdup,
it's not documented to do that.  (For that matter, strdup could return
NULL, which we don't handle at all.)  I'm not sure we'd like to
instill that change in clients, by having them start to LIBC.free()
the result.  Or do we?  Maybe old clients would leak, but new ones
(running against the new libpcp.so only?) could free() the leak.

- FChE

<Prev in Thread] Current Thread [Next in Thread>