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:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+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
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
+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
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;
}