comparison Modules/python.c @ 77782:f77998006917

If main() is called and an argument cannot be decoded, make sure to free the copy of the command-line. Found using Clang's static analyzer.
author Brett Cannon <brett@python.org>
date Mon, 25 Jun 2012 16:25:28 -0400
parents c0900fd6e4b3
children 26c4748351cb 48fbdaf3a849
comparison
equal deleted inserted replaced
77781:85e8d2f9b33e 77782:f77998006917
49 argv_copy[i] = _Py_DecodeUTF8_surrogateescape(argv[i], strlen(argv[i])); 49 argv_copy[i] = _Py_DecodeUTF8_surrogateescape(argv[i], strlen(argv[i]));
50 #else 50 #else
51 argv_copy[i] = _Py_char2wchar(argv[i], NULL); 51 argv_copy[i] = _Py_char2wchar(argv[i], NULL);
52 #endif 52 #endif
53 if (!argv_copy[i]) { 53 if (!argv_copy[i]) {
54 free(oldloc);
54 fprintf(stderr, "Fatal Python error: " 55 fprintf(stderr, "Fatal Python error: "
55 "unable to decode the command line argument #%i\n", 56 "unable to decode the command line argument #%i\n",
56 i + 1); 57 i + 1);
57 return 1; 58 return 1;
58 } 59 }