The char * from BN_bn2hex needs to be freed.


On Sun, Dec 22, 2013 at 9:41 PM, Paul Kehrer <notifications@github.com>wrote:

> In cryptography/hazmat/backends/openssl/backend.py:
>
> > +        return self._get_value(self._ctx.e)
> > +
> > +    @property
> > +    def d(self):
> > +        return self._get_value(self._ctx.d)
> > +
> > +    @property
> > +    def modulus(self):
> > +        return self._get_value(self._ctx.n)
> > +
> > +    @property
> > +    def public_exponent(self):
> > +        return self._get_value(self._ctx.e)
> > +
> > +    def _get_value(self, bn):
> > +        val = self._backend.lib.BN_bn2hex(bn)
>
> This should look more like
>
>     def _get_value(self, bn):
>         val = self._backend.lib.BN_bn2hex(bn)
>         if val == self._backend.ffi.NULL:
>             self._backend._handle_error()
>         return int(self._backend.ffi.string(val), 16)
>
> but I'm not seeing anything that needs to be freed. Am I missing something?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/pyca/cryptography/pull/292/files#r8522679>
> .
>



-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084