[fpc-devel] TProcess empty parameter

Marco van de Voort marcov at stack.nl
Thu May 7 14:45:24 CEST 2015


In our previous episode, Michael Van Canneyt said:
> > so it seems to be the emptychar story. Better fix that as well.
> > Unfortunately, FPC_emptychar is not exported from system.
> 
> No, and you cannot use that directly, because in case of an error, the items in the argv 
> array and the array itself are freed (or so I hope). 
> The FPC_emptychar pointer should not be freed...

I found that out too. The patch I send earlier therefore only copies from
it, but better maybe to eliminate the use of emptychar entirely.

> fixing strnew() to allocate a single #0 on the heap is probably best.

strnew uses stralloc which in turn can only be disposed with strdispose. 
(prefixes 4 bytes length and futhers the pointer) In theory one can make
thus an exception in strdispose too, but IMHO not worth it.



More information about the fpc-devel mailing list