[gvfs/mtp-backend: 56/64] MTP: Review Feedback: Remove use of static buffer.



commit 5ae18e30fab90ceabe051c6789791dae13014c3d
Author: Philip Langdale <philipl overt org>
Date:   Thu Jan 3 20:44:28 2013 -0800

    MTP: Review Feedback: Remove use of static buffer.
    
    Use a dynamically allocated buffer instead to avoid any
    multi-threading dangers.

 monitor/mtp/gmtpvolume.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/monitor/mtp/gmtpvolume.c b/monitor/mtp/gmtpvolume.c
index c59bba1..bfb453a 100644
--- a/monitor/mtp/gmtpvolume.c
+++ b/monitor/mtp/gmtpvolume.c
@@ -105,13 +105,15 @@ static int hexdigit (char c)
 static const char*
 udev_decode_string (const char* encoded)
 {
-  static char decoded[4096];
   int len;
   const char* s;
+  char *decoded;
 
   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]