[easytag] Fix two memory leaks in scanner



commit ae3dd7b81ba283ba0e9ea3d4aff326deedcc077e
Author: Santtu Lakkala <inz inz fi>
Date:   Tue Feb 11 10:16:37 2014 +0000

    Fix two memory leaks in scanner
    
    Free the result of g_utf8_strup() in
    Scan_Process_Fields_First_Letters_Uppercase() Roman numeral handling.

 src/scan.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/scan.c b/src/scan.c
index 081be4f..3e210e1 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -1550,7 +1550,9 @@ void Scan_Process_Fields_First_Letters_Uppercase (gchar *string)
     // If the word is a roman numeral, capitalize all of it
     if ((len = Scan_Word_Is_Roman_Numeral(temp)))
     {
-        strncpy(string, g_utf8_strup(temp, len), len);
+        gchar *tmp = g_utf8_strup (temp, len);
+        strncpy (string, tmp, len);
+        g_free (tmp);
     } else
     {
         // Set first character to uppercase
@@ -1588,7 +1590,9 @@ void Scan_Process_Fields_First_Letters_Uppercase (gchar *string)
         // If the word is a roman numeral, capitalize all of it
         if ((len = Scan_Word_Is_Roman_Numeral(word)))
         {
-            strncpy(word, g_utf8_strup(word, len), len);
+            gchar *tmp = g_utf8_strup (temp, len);
+            strncpy (string, tmp, len);
+            g_free (tmp);
         } else
         {
             // Set uppercase the first character of this word


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