https://github.com/jleffler/soq/blob/bb84e0704fb66a558fbcf507f43e76a7a547930e/src/libsoq/debug.c#L57C1-L59C1
if (debugfp != stdin && debugfp != stdout && debugfp != stderr)
fclose(debugfp);
debugfp = dbfp;
In main:
Here, debugfp is initialized with 0 and then is attempted to close in db_setfileptr, leading to SEGFAULT