projects
/
claws.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aadb7d5
)
Fix leak on failing realloc
author
Ricardo Mones
<ricardo@mones.org>
Thu, 18 Jun 2015 00:13:28 +0000
(
02:13
+0200)
committer
Ricardo Mones
<ricardo@mones.org>
Thu, 18 Jun 2015 00:13:28 +0000
(
02:13
+0200)
src/plugins/pgpcore/sgpgme.c
patch
|
blob
|
history
diff --git
a/src/plugins/pgpcore/sgpgme.c
b/src/plugins/pgpcore/sgpgme.c
index 4b09d9cec6a0a4d2c6367bf865a4feab461cd848..bd14362d6980a0782d6981f8ed07802ad039c764 100644
(file)
--- a/
src/plugins/pgpcore/sgpgme.c
+++ b/
src/plugins/pgpcore/sgpgme.c
@@
-979,11
+979,14
@@
void *sgpgme_data_release_and_get_mem(gpgme_data_t data, size_t *len)
/* I know it's deprecated, but we don't compile with _LARGEFILE */
cm_gpgme_data_rewind(data);
while ((r = gpgme_data_read(data, buf, BUFSIZ)) > 0) {
- result = realloc(result, r + w);
- if (result == NULL) {
+
void *r
result = realloc(result, r + w);
+ if (r
r
esult == NULL) {
g_warning("can't allocate memory\n");
+ if (result != NULL)
+ free(result);
return NULL;
}
+ result = rresult;
memcpy(result+w, buf, r);
w += r;
}