BPython:
- Scripts that ended without an [eol] (end of line char) would give syntax errors when called from menus. Now all loaded menu scripts have '\\n\\0' appended to them, not only '\\0' as before. - bug #1146: Kester reported a Valgrind warning, should be fixed now.
This commit is contained in:
@@ -608,9 +608,10 @@ int BPY_menu_do_python(short menutype, int event)
|
||||
len = ftell(fp);
|
||||
fseek(fp, 0L, SEEK_SET);
|
||||
|
||||
buffer = MEM_mallocN(len+1, "pyfilebuf"); /* len+1 to add '\0' */
|
||||
buffer = MEM_mallocN(len+2, "pyfilebuf"); /* len+2 to add '\n\0' */
|
||||
len = fread(buffer, 1, len, fp);
|
||||
|
||||
buffer[len-1] = '\n'; /* to fix potential syntax error */
|
||||
buffer[len] = '\0';
|
||||
|
||||
/* fast clean-up of dos cr/lf line endings: change '\r' to space */
|
||||
|
||||
Reference in New Issue
Block a user