+ if (!fclose(fp))
+ strbuf_detach(&buf, NULL);
+ else
+ strbuf_release(&buf);
Why these two cases? Aren't you leaking the buffer when calling
strbuf_detach and ignoring its return value?
(In general, there's not much to do when fclose fails actually)
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/