summaryrefslogtreecommitdiff
path: root/sfeedrc.example
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2023-03-07 21:04:36 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2023-03-07 21:09:38 +0100
commit426fa33dd276fbe662b3794c41db1ab6d59b3c2a (patch)
treec171dbefbfd961f30356f1dd4afeffca1e13febe /sfeedrc.example
parent19a4c010f95ad17e02ca59e9949524e801ad22f2 (diff)
sfeed_curses: fix (very hard to trigger) memleak when getline() returns EOF for lazyloaded items
Fix the code pattern of freeing the line when getline returns -1 but no error flag is set on the stream (such as EOF). Note that on errors (even ENOMEM: out-of-memory) an error flag is set on the stream and the process would exit and clean up all it's resources. This would be very hard to trigger. The following conditions would have to be true: * Lazyloading of items is enabled: SFEED_LAZYLOAD=1 is set. * Items of the feed are read and their offsets stored. * The line is read/lazy-loaded again by it's offset but returns EOF (not a read error) this time. This could maybe happen if the feed file was changed and made smaller while sfeed_curses is running and the remembered offset is now beyond the file. Note that the sfeed_curses(1) man page describes a workaround for a similar condition by sending SIGHUP if the sfeed(5) data was changed to reload the feed file. References: * https://man.openbsd.org/getline "It is the responsibility of the caller to free(3) *lineptr when it is no longer needed. Even when it fails, getdelim() may update *lineptr." * https://pubs.opengroup.org/onlinepubs/9699919799/functions/getline.html
Diffstat (limited to 'sfeedrc.example')
0 files changed, 0 insertions, 0 deletions