|
Re: [pokersource] seg fault issue
>
> Hey all I'm getting a segfault problem now. I tried to put in the
> eval.c sample into my app with some changes and it processes find but
> then the next call to the app it seg faults
>
[...]
> char *str;
> //QString *str;
> //str->append("bla");
> HandVal_toString(handval, str);
HandVal_toString assumes that there is already space backing its second
argument. If you 'str = malloc(REASONABLE_NUMBER);' or 'char str[SAME_IDEA];'
with the correct error checking in the first case all will be well.
[...]
> its something with HandVal_toString that is causing it to error. [...]
> If i just use HandVal_print() it works just fine.. I'm stumped here..
If you find the function which backs HandVal_print you will see it uses an
allocated (in that case on the stack) buffer when it calls HandVal_toString.
mph
|