mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* app-openpgp.c (get_cached_data): Avoid mallocing zero since it breaks us
when using --enable-m-guard.
This commit is contained in:
parent
b700d3cd3e
commit
dccd0d991b
2 changed files with 15 additions and 8 deletions
|
@ -124,7 +124,6 @@ get_cached_data (app_t app, int tag,
|
|||
size_t len;
|
||||
struct cache_s *c;
|
||||
|
||||
|
||||
*result = NULL;
|
||||
*resultlen = 0;
|
||||
|
||||
|
@ -133,13 +132,18 @@ get_cached_data (app_t app, int tag,
|
|||
for (c=app->app_local->cache; c; c = c->next)
|
||||
if (c->tag == tag)
|
||||
{
|
||||
p = xtrymalloc (c->length);
|
||||
if (!p)
|
||||
return gpg_error (gpg_err_code_from_errno (errno));
|
||||
memcpy (p, c->data, c->length);
|
||||
*resultlen = c->length;
|
||||
*result = p;
|
||||
return 0;
|
||||
if(c->length)
|
||||
{
|
||||
p = xtrymalloc (c->length);
|
||||
if (!p)
|
||||
return gpg_error (gpg_err_code_from_errno (errno));
|
||||
memcpy (p, c->data, c->length);
|
||||
*result = p;
|
||||
}
|
||||
|
||||
*resultlen = c->length;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue