View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000716 | FreeCAD | Bug | public | 2012-05-21 19:15 | 2012-05-23 11:04 |
Reporter | flelchuk | Assigned To | |||
Priority | normal | Severity | trivial | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 0.12 | ||||
Fixed in Version | 0.13 | ||||
Summary | 0000716: src/Tools/PyTools.c: strange assignment and a memory leak | ||||
Description | In src/Tools/PyTools.c it reads: 00375 const char *PP_Init(const char *modname) { 00376 Py_Initialize(); /* init python if needed */ 00377 //#ifdef FC_OS_LINUX /* cannot convert `const char *' to `char *' in assignment */ 00378 if (modname!=NULL) return modname; 00379 { /* we assume here that the caller frees allocated memory */ 00380 char* __main__=(char *)malloc(sizeof("__main__")); 00381 return __main__="__main__"; 00382 } 00383 //#else 00384 // return modname == NULL ? "__main__" : modname; /* default to '__main__' */ 00385 //#endif 00386 } What's in line 381 does not really make sense. Instead of making a copy, the only reference to the previously malloc'd memory is lost. I'd suggest to remove line 380 and replace line 381 with return "__main__"; Best Regards, Felix | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||