Skip to contentSkip to conversation

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

PATCH New [email protected] 1 participant 1 message Nov 2, 2014 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

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

From: Akihiro Tsukada <[email protected]>

---
 lib/libdvbv5/countries.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/libdvbv5/countries.c +3 -3
index 7acdcc7..9e68ea6 100644
@@ -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
Signature · 1 line
2.1.3