This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=aea0858f52cb2ca100f34389d1864cd6a0fe1fb5 commit aea0858f52cb2ca100f34389d1864cd6a0fe1fb5 Author: Guillem Jover <guil...@debian.org> AuthorDate: Fri Jul 21 00:11:30 2023 +0200 libdpkg: Change varbuf_get_str() to return "" instead of initializing it When we have a varbuf that has not been populated, growing its memory to simply add a NUL character is a waste. Instead simply return a constant empty string. --- lib/dpkg/varbuf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/dpkg/varbuf.c b/lib/dpkg/varbuf.c index a5d3d3193..268a03925 100644 --- a/lib/dpkg/varbuf.c +++ b/lib/dpkg/varbuf.c @@ -94,6 +94,9 @@ varbuf_reset(struct varbuf *v) const char * varbuf_get_str(struct varbuf *v) { + if (v->buf == NULL) + return ""; + varbuf_end_str(v); return v->buf; -- Dpkg.Org's dpkg