RE: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Jeremy Farrell
> From: Adam M [mailto:open...@irotas.net] > Sent: Wednesday, January 29, 2014 2:56 AM > > On Tue, Jan 28, 2014, at 05:18 PM, Dr. Stephen Henson wrote: > > > > Yes the documention is rather old and could be clearer. > > > > I had to double check with the source to see what was happening. > > ... >

Re: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Adam M
On Tue, Jan 28, 2014, at 05:18 PM, Dr. Stephen Henson wrote: > On Tue, Jan 28, 2014, Adam McLaurin wrote: > > > I suspect this will result in a double free bug, as I don't think memory > > ownership of 'data' is actually passed back to the caller (which is why > > it's 'const char**'). The error i

RE: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Jeremy Farrell
> From: Jeremy Farrell > Sent: Wednesday, January 29, 2014 1:39 AM > > > From: Dr. Stephen Henson [mailto:st...@openssl.org] > > Sent: Wednesday, January 29, 2014 12:50 AM > > To: openssl-users@openssl.org > > > > On Tue, Jan 28, 2014, Jeremy Farrell wrote: > > > > > > > > Ugh. Thanks for checking

RE: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Jeremy Farrell
> From: Dr. Stephen Henson [mailto:st...@openssl.org] > Sent: Wednesday, January 29, 2014 12:50 AM > To: openssl-users@openssl.org > > On Tue, Jan 28, 2014, Jeremy Farrell wrote: > > > > > Ugh. Thanks for checking Steve, that's rather different from the > > understanding I'd built up. I suggest a

Re: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Dr. Stephen Henson
On Tue, Jan 28, 2014, Jeremy Farrell wrote: > > Ugh. Thanks for checking Steve, that's rather different from the > understanding I'd built up. I suggest a quick fix to improve the > documentation would be simply to delete the sentence "If it has been > allocated by OPENSSL_malloc(), *flags&ERR_TX

RE: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Jeremy Farrell
> From: Dr. Stephen Henson [mailto:st...@openssl.org] > Sent: Tuesday, January 28, 2014 10:19 PM > To: openssl-users@openssl.org > > On Tue, Jan 28, 2014, Adam McLaurin wrote: > > > I suspect this will result in a double free bug, as I don't think > memory > > ownership of 'data' is actually pass

Re: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Dr. Stephen Henson
On Tue, Jan 28, 2014, Adam McLaurin wrote: > I suspect this will result in a double free bug, as I don't think memory > ownership of 'data' is actually passed back to the caller (which is why > it's 'const char**'). The error isn't really 'popped' from the queue - > the queue just gets some indexe

Re: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Adam McLaurin
I suspect this will result in a double free bug, as I don't think memory ownership of 'data' is actually passed back to the caller (which is why it's 'const char**'). The error isn't really 'popped' from the queue - the queue just gets some indexes adjusted but the structure itself seems unmodified

RE: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Jeremy Farrell
In C: if ( data != NULL && flags & ERR_TXT_STRING ) { PRINT(data); if ( flags & ERR_TXT_MALLOCED ) { OPENSSL_free((void *)data); } } > From: Adam M [mailto:open...@irotas.net] > Sent: Tuesday, January 28, 2014 5:47 PM > To: openssl-users@openssl.org > > I'm

RE: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Jeremy Farrell
> From: Dr. Stephen Henson [mailto:st...@openssl.org] > Sent: Tuesday, January 28, 2014 6:41 PM > On Tue, Jan 28, 2014, Adam M wrote: > > > Hi, > > > > I'm reading the documentation for ERR_get_error_line_data() here: > > http://www.openssl.org/docs/crypto/ERR_get_error.html > > > > The comments s

Re: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Adam M
On Tue, Jan 28, 2014, at 01:41 PM, Dr. Stephen Henson wrote: > On Tue, Jan 28, 2014, Adam M wrote: > > > Hi, > > > > I'm reading the documentation for ERR_get_error_line_data() here: > > http://www.openssl.org/docs/crypto/ERR_get_error.html > > > > The comments say that 'data' is dynamically all

Re: Unclear how to free 'data' allocated in ERR_get_error_line_data()

2014-01-28 Thread Dr. Stephen Henson
On Tue, Jan 28, 2014, Adam M wrote: > Hi, > > I'm reading the documentation for ERR_get_error_line_data() here: > http://www.openssl.org/docs/crypto/ERR_get_error.html > > The comments say that 'data' is dynamically allocated with > OPENSSL_malloc() if the ERR_TXT_MALLOCED bit is set in 'flags'.