doc/
2006-09-25 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Destroying Data Buffers): Clarify that gpgme_data_release_and_get_mem destroys DH unconditionally. gpgme/ 2006-09-25 Marcus Brinkmann <marcus@g10code.de> * data-mem.c (gpgme_data_release_and_get_mem): Release the data object properly.
This commit is contained in:
parent
4b1393f664
commit
9247e9081b
2
NEWS
2
NEWS
@ -1,6 +1,8 @@
|
||||
Noteworthy changes in version 1.1.3 (unreleased)
|
||||
------------------------------------------------
|
||||
|
||||
* Fixed a memory leak in gpgme_data_release_and_get_mem.
|
||||
|
||||
* Interface changes relative to the 1.1.1 release:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -1,3 +1,8 @@
|
||||
2006-09-25 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Destroying Data Buffers): Clarify that
|
||||
gpgme_data_release_and_get_mem destroys DH unconditionally.
|
||||
|
||||
2005-03-24 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Library Version Check): Make example code compatible
|
||||
|
@ -1719,7 +1719,8 @@ the user provided the data buffer in non-copy mode, a copy will be
|
||||
made for this purpose.
|
||||
|
||||
In case an error returns, or there is no suitable data buffer that can
|
||||
be returned to the user, the function will return @code{NULL}.
|
||||
be returned to the user, the function will return @code{NULL}. In any
|
||||
case, the data object @var{dh} is destroyed.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2006-09-25 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* data-mem.c (gpgme_data_release_and_get_mem): Release the data
|
||||
object properly.
|
||||
|
||||
2006-09-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* keylist.c (keylist_colon_handler): Move debug output after
|
||||
|
@ -210,20 +210,32 @@ gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len)
|
||||
char *str = NULL;
|
||||
|
||||
if (!dh || dh->cbs != &mem_cbs)
|
||||
return NULL;
|
||||
{
|
||||
gpgme_data_release (dh);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
str = dh->data.mem.buffer;
|
||||
if (!str && dh->data.mem.orig_buffer)
|
||||
{
|
||||
str = malloc (dh->data.mem.length);
|
||||
if (!str)
|
||||
return NULL;
|
||||
{
|
||||
gpgme_data_release (dh);
|
||||
return NULL;
|
||||
}
|
||||
memcpy (str, dh->data.mem.orig_buffer, dh->data.mem.length);
|
||||
}
|
||||
else
|
||||
/* Prevent mem_release from releasing the buffer memory. We must
|
||||
not fail from this point. */
|
||||
dh->data.mem.buffer = NULL;
|
||||
|
||||
if (r_len)
|
||||
*r_len = dh->data.mem.length;
|
||||
|
||||
gpgme_data_release (dh);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user