[PATCH] wrc: Fixed some small leaks in PO code (Coverity)

Marcus Meissner marcus at jet.franken.de
Tue Jun 28 01:31:29 CDT 2011


Hi,

collection of some small memory leaks in wrc and wmc po handling.

Ciao, Marcus
---
 tools/wmc/po.c |    1 +
 tools/wrc/po.c |    6 +++++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/tools/wmc/po.c b/tools/wmc/po.c
index 06b5bc7..5edc0ba 100644
--- a/tools/wmc/po.c
+++ b/tools/wmc/po.c
@@ -325,6 +325,7 @@ static char *convert_msgid_ascii( const lanmsg_t *msg, int error_on_invalid_char
             fprintf( stderr, "%s:%d: ", msg->file, msg->line );
             error( "Invalid character %04x in source string\n", msg->msg[i] );
         }
+        free( buffer );
         return NULL;
     }
     buffer[i] = 0;
diff --git a/tools/wrc/po.c b/tools/wrc/po.c
index ef1e9f2..0b5f7ef 100644
--- a/tools/wrc/po.c
+++ b/tools/wrc/po.c
@@ -332,6 +332,7 @@ static char *convert_msgid_ascii( const string_t *str, int error_on_invalid_char
             print_location( &newstr->loc );
             error( "Invalid character %04x in source string\n", newstr->str.wstr[i] );
         }
+        free( buffer);
         free_string( newstr );
         return NULL;
     }
@@ -940,7 +941,10 @@ void add_translations( const char *po_dir )
     new_top = new_tail = NULL;
 
     name = strmake( "%s/LINGUAS", po_dir );
-    if (!(f = fopen( name, "r" ))) return;
+    if (!(f = fopen( name, "r" ))) {
+        free( name );
+        return;
+    }
     free( name );
     while (fgets( buffer, sizeof(buffer), f ))
     {
-- 
1.7.3.4




More information about the wine-patches mailing list