From b07408cf82a9b7fc4dc093d08d07f835fad3bf48 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Tue, 28 Jun 2011 08:31:29 +0200 Subject: [PATCH] wrc: Fixed some small leaks in PO code (Coverity). --- tools/wmc/po.c | 1 + tools/wrc/po.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/wmc/po.c b/tools/wmc/po.c index 06b5bc7dc64..1cdf521a9b3 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 ef1e9f29f5f..af882cb99bc 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,11 @@ 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 )) {