]> granicus.if.org Git - graphviz/commit
cgraph: fix: handle allocation failures in 'agcanon' and friends
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 25 Feb 2022 16:18:17 +0000 (08:18 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 27 Feb 2022 21:13:32 +0000 (13:13 -0800)
commit343ac83aae88692ba36fcd4e6895c3917ab258d2
treee24f9d94fdc864124a7f00079b5c01c9552785be
parent29e9665d0de1d138ca213c0cf2d6dbd86987046b
cgraph: fix: handle allocation failures in 'agcanon' and friends

There are a number of cgraph API functions that use an internally managed buffer
to save the caller from having to allocate space themselves. Failure to expand
this buffer was being silently ignored, resulting in messy crashes when memory
was exhausted. These failures are now checked for and `agcanon` and `agcanonStr`
return `NULL` on allocation failure. `agwrite` returns `EOF` on allocation
failure.
CHANGELOG.md
lib/cgraph/write.c