[gvfs] mtpvolume: fix a memory leak



commit 5076749384dd769b16025c1cc8281772bf8a0c8d
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Jan 29 19:08:35 2014 +0100

    mtpvolume: fix a memory leak
    
    Make the buffer really static, as the comment above documents.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723251

 monitor/mtp/gmtpvolume.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
---
diff --git a/monitor/mtp/gmtpvolume.c b/monitor/mtp/gmtpvolume.c
index 2c13fd6..58ef0dd 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') {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]