mono/CppSharp — pull request #261 by tomba (2014-05-19 11:53:07+00:00)
Title: CppParser: fix memory corruption issue

There are multiple places in the parser which do something similar to
this:

Foo *ptr = 0;

if (...) {
Foo val = ...;
ptr = &val;
}

func(ptr);

In other words, the code takes a pointer to a local variable, and the
pointer is used even after the local variable's scope has ended.

This causes a crash on Linux. For some reason this works fine on Windows
+ Visual studio.

This patchs moves the variable ("val" in the above example) to outer
scopes, so that its life time is extended to cover the use.

Signed-off-by: Tomi Valkeinen