summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2014-01-29 19:08:35 +0100
committerGiovanni Campagna <gcampagna@src.gnome.org>2014-02-08 22:03:09 +0100
commit5076749384dd769b16025c1cc8281772bf8a0c8d (patch)
tree518a528ba137f4aaa7649a6c718b42a6be83f6ae
parent0888a45453393b9c94e36f4929ea939925ce1f83 (diff)
downloadgvfs-5076749384dd769b16025c1cc8281772bf8a0c8d.tar.gz
mtpvolume: fix a memory leak
Make the buffer really static, as the comment above documents. https://bugzilla.gnome.org/show_bug.cgi?id=723251
-rw-r--r--monitor/mtp/gmtpvolume.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/monitor/mtp/gmtpvolume.c b/monitor/mtp/gmtpvolume.c
index 2c13fd6b..58ef0dd7 100644
--- a/monitor/mtp/gmtpvolume.c
+++ b/monitor/mtp/gmtpvolume.c
@@ -102,13 +102,11 @@ udev_decode_string (const char* encoded)
{
int len;
const char* s;
- char *decoded;
+ static char decoded[4096];
if (encoded == NULL)
return NULL;
- decoded = g_malloc(4096);
-
for (len = 0, s = encoded; *s && len < sizeof (decoded) - 1; ++len, ++s) {
/* need to check for NUL terminator in advance */
if (s[0] == '\\' && s[1] == 'x' && s[2] >= '0' && s[3] >= '0') {