If I'm not wrong you can take a similar approach to the one I took in
my OpenAL wrapper on the Dumping Grounds page of the Gambit Wiki
(http://dynamo.iro.umontreal.ca/wiki/images/2/2c/OpenAL.tar.gz). When
I allocate a foreign struct, I attach a will to the object and in the
will free the underlying C pointer when the foreign object is garbage
collected. The implementation is at the bottom of the file labelled
'foreign-macros.scm' in that tarball.