zstream: grow based on used memory rather than allocated
zstream: grow based on used memory rather than allocated

When deflating data, we might need to grow the buffer. Currently we
add a guess on top of the currently-allocated buffer size.

When we re-use the buffer, it already has some memory allocated; adding
to that means that we always grow the buffer regardless of how much we
need to use.

Instead, increase on top of the currently-used size. This still leaves
us with the allocated size of the largest object we compress, but it's a
minor pain compared to unbounded growth.

This fixes #2285.

iankronquist/libgit2,iankronquist/libgit2,linquize/libgit2,leoyanggit/libgit2,mingyaaaa/libgit2,saurabhsuniljain/libgit2,rcorre/libgit2,yosefhackmon/libgit2,yosefhackmon/libgit2,mingyaaaa/libgit2,saurabhsuniljain/libgit2,since2014/libgit2,spraints/libgit2,spraints/libgit2,spraints/libgit2,nokiddin/libgit2,whoisj/libgit2,mhp/libgit2,chiayolin/libgit2,oaastest/libgit2,Snazz2001/libgit2,mingyaaaa/libgit2,skabel/manguse,dleehr/libgit2,yongthecoder/libgit2,yongthecoder/libgit2,JIghtuse/libgit2,sygool/libgit2,maxiaoqian/libgit2,yongthecoder/libgit2,JIghtuse/libgit2,claudelee/libgit2,ardumont/libgit2,whoisj/libgit2,mcanthony/libgit2,jeffhostetler/public_libgit2,MrHacky/libgit2,mhp/libgit2,amyvmiwei/libgit2,amyvmiwei/libgit2,falqas/libgit2,oaastest/libgit2,kenprice/libgit2,maxiaoqian/libgit2,magnus98/TEST,Corillian/libgit2,jflesch/libgit2-mariadb,iankronquist/libgit2,yongthecoder/libgit2,since2014/libgit2,swisspol/DEMO-libgit2,KTXSoftware/libgit2,KTXSoftware/libgit2,oaastest/libgit2,nokiddin/libgit2,oaastest/libgit2,chiayolin/libgit2,mcanthony/libgit2,t0xicCode/libgit2,stewid/libgit2,joshtriplett/libgit2,amyvmiwei/libgit2,sim0629/libgit2,claudelee/libgit2,Corillian/libgit2,chiayolin/libgit2,yosefhackmon/libgit2,jflesch/libgit2-mariadb,ardumont/libgit2,sim0629/libgit2,KTXSoftware/libgit2,oaastest/libgit2,rcorre/libgit2,dleehr/libgit2,spraints/libgit2,since2014/libgit2,since2014/libgit2,kenprice/libgit2,raybrad/libit2,jflesch/libgit2-mariadb,stewid/libgit2,t0xicCode/libgit2,jflesch/libgit2-mariadb,kenprice/libgit2,whoisj/libgit2,linquize/libgit2,raybrad/libit2,mrksrm/Mingijura,leoyanggit/libgit2,chiayolin/libgit2,falqas/libgit2,t0xicCode/libgit2,nokiddin/libgit2,claudelee/libgit2,kenprice/libgit2,iankronquist/libgit2,stewid/libgit2,sygool/libgit2,Corillian/libgit2,JIghtuse/libgit2,oaastest/libgit2,JIghtuse/libgit2,MrHacky/libgit2,saurabhsuniljain/libgit2,saurabhsuniljain/libgit2,skabel/manguse,claudelee/libgit2,jeffhostetler/public_libgit2,leoyanggit/libgit2,MrHacky/libgit2,kissthink/libgit2,MrHacky/libgit2,swisspol/DEMO-libgit2,nokiddin/libgit2,nokiddin/libgit2,dleehr/libgit2,magnus98/TEST,dleehr/libgit2,mingyaaaa/libgit2,mcanthony/libgit2,falqas/libgit2,yosefhackmon/libgit2,mcanthony/libgit2,skabel/manguse,Tousiph/Demo1,kissthink/libgit2,Tousiph/Demo1,mrksrm/Mingijura,spraints/libgit2,swisspol/DEMO-libgit2,swisspol/DEMO-libgit2,Snazz2001/libgit2,ardumont/libgit2,mrksrm/Mingijura,mrksrm/Mingijura,raybrad/libit2,joshtriplett/libgit2,stewid/libgit2,KTXSoftware/libgit2,mingyaaaa/libgit2,Snazz2001/libgit2,skabel/manguse,linquize/libgit2,Corillian/libgit2,maxiaoqian/libgit2,t0xicCode/libgit2,rcorre/libgit2,falqas/libgit2,saurabhsuniljain/libgit2,Tousiph/Demo1,kissthink/libgit2,rcorre/libgit2,joshtriplett/libgit2,ardumont/libgit2,Corillian/libgit2,swisspol/DEMO-libgit2,linquize/libgit2,magnus98/TEST,sim0629/libgit2,Snazz2001/libgit2,ardumont/libgit2,mhp/libgit2,joshtriplett/libgit2,whoisj/libgit2,whoisj/libgit2,linquize/libgit2,skabel/manguse,kenprice/libgit2,yongthecoder/libgit2,magnus98/TEST,chiayolin/libgit2,sygool/libgit2,JIghtuse/libgit2,sim0629/libgit2,yosefhackmon/libgit2,KTXSoftware/libgit2,yosefhackmon/libgit2,mhp/libgit2,linquize/libgit2,dleehr/libgit2,maxiaoqian/libgit2,iankronquist/libgit2,nokiddin/libgit2,jeffhostetler/public_libgit2,maxiaoqian/libgit2,Snazz2001/libgit2,since2014/libgit2,raybrad/libit2,sygool/libgit2,Corillian/libgit2,t0xicCode/libgit2,mrksrm/Mingijura,falqas/libgit2,mcanthony/libgit2,mrksrm/Mingijura,MrHacky/libgit2,kissthink/libgit2,mcanthony/libgit2,claudelee/libgit2,chiayolin/libgit2,jflesch/libgit2-mariadb,leoyanggit/libgit2,ardumont/libgit2,whoisj/libgit2,magnus98/TEST,jeffhostetler/public_libgit2,amyvmiwei/libgit2,joshtriplett/libgit2,leoyanggit/libgit2,MrHacky/libgit2,t0xicCode/libgit2,rcorre/libgit2,joshtriplett/libgit2,JIghtuse/libgit2,stewid/libgit2,jflesch/libgit2-mariadb,kenprice/libgit2,dleehr/libgit2,Tousiph/Demo1,saurabhsuniljain/libgit2,mingyaaaa/libgit2,jeffhostetler/public_libgit2,amyvmiwei/libgit2,sygool/libgit2,skabel/manguse,falqas/libgit2,Snazz2001/libgit2,mhp/libgit2,stewid/libgit2,leoyanggit/libgit2,kissthink/libgit2,kissthink/libgit2,Tousiph/Demo1,yongthecoder/libgit2,jeffhostetler/public_libgit2,swisspol/DEMO-libgit2,iankronquist/libgit2,mhp/libgit2,sygool/libgit2,spraints/libgit2,rcorre/libgit2,sim0629/libgit2,raybrad/libit2,KTXSoftware/libgit2,Tousiph/Demo1,since2014/libgit2,claudelee/libgit2,amyvmiwei/libgit2,magnus98/TEST,sim0629/libgit2,maxiaoqian/libgit2