I found a memory leak, just reading Nyquist C sources

Is this the right board to report this? Call it a “code review.”

Try this in the Nyquist prompt, no matter how small the selection, and watch memory usage of the Audacity process:

(dotimes (i 10000000)
(snd-maxsamp s))

Untried fix: at line 106 of samples.c, change

    return (double) (s->scale * result);

to

    { double the_result = (s->scale * result); sound-unref(s); return the_result; }

(This on just my first day of digging into the sources. Time to install an actual compiler and debugger, I suppose.)

Perhaps you could just unref before returning the value, without a new variable… I must be thinking in terms of Lisp or of concurrent programming.