While working on #139 I noticed something suspicious.
We have a number of statements like this:
if ((val = rb_hash_lookup(opts, ID2SYM(id_host))) != Qnil) {
Check_Type(val, T_STRING);
connopt.hostname = StringValueCStr(val);
opts is held as @connection_options on the Trilogy instance, so val and it's char * won't be GCed, however:
- We don't ensure the string is frozen, so it could be mutated later on.
- We these strings aren't pined, so if they are embedded, they could be moved elsewhere, causing
connopt to point at garbage / another object.