Dear Petri,
thank you for your quick answer.
I am also puzzled by the initial strdup() not working.
I wanted to inform you that using strdup(row[0]) was my initial idea of
fixing the issue, I used only row[0] before this. I wanted to take the
risk of (temporarily) introducing memory leaks if it helps debugging.
Also, thank you for your remark on 'o' vs. 'O'.
To give further feedback, I quickly checked whether compiler
optimizations may cause the problem, but have a negative result.
While the "normal" settings produce a glibc error (the double-free) on a
seemingly unrelated later part of the code, where even gdb gets the
backtrace wrong, I tried to use gcc -O0 and to set
mallopt(M_MMAP_THRESHOLD, 4); as suggested in #glibc, without success.
I think I have to further investigate whether sql_free_result() has also
an implication on my MYSQL_ROW variable, i.e., the error eventually is
unrelated to libjansson, but I wanted to ask here first. :)
Kind regards,
Roman