Commit 19c32473 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

darwinvlc: check malloc return and free

parent fa08bfb6
......@@ -248,12 +248,16 @@ int main(int i_argc, const char *ppsz_argv[])
if (length > 0) {
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
lang = (char *)malloc(maxSize);
CFStringGetCString(language, lang, maxSize - 1, kCFStringEncodingUTF8);
}
if (strncmp( lang, "auto", 4 )) {
char tmp[11];
snprintf(tmp, 11, "LANG=%s", lang);
putenv(tmp);
if(lang) {
CFStringGetCString(language, lang, maxSize - 1, kCFStringEncodingUTF8);
if (strncmp( lang, "auto", 4 )) {
char tmp[11];
snprintf(tmp, 11, "LANG=%s", lang);
putenv(tmp);
}
}
free(lang);
}
CFRelease(language);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment