[PATCH] v4l-utils/libdvbv5: fix memory leak in dvb_guess_user_country()

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

 



From: Akihiro Tsukada <tskd08@xxxxxxxxx>

Signed-off-by: Akihiro Tsukada <tskd08@xxxxxxxxx>
---
 lib/libdvbv5/countries.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/libdvbv5/countries.c b/lib/libdvbv5/countries.c
index 7acdcc7..9e68ea6 100644
--- a/lib/libdvbv5/countries.c
+++ b/lib/libdvbv5/countries.c
@@ -395,13 +395,13 @@ enum dvb_country_t dvb_guess_user_country(void)
 		if (! buf || strlen(buf) < 2)
 			continue;
 
-		buf = strdup(buf);
-		pbuf= buf;
-
 		if (! strncmp(buf, "POSIX", MIN(strlen(buf), 5)) ||
 		    ! (strncmp(buf, "en", MIN(strlen(buf), 2)) && !isalpha(buf[2])) )
 			continue;
 
+		buf = strdup(buf);
+		pbuf= buf;
+
 		// assuming 'language_country.encoding@variant'
 
 		// country after '_', if given
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux