refs: fix memory leak on rename
refs: fix memory leak on rename

Current implementation of git_reference_rename() removes 'ref' from
loose cache, but not frees it. In result 'ref' is not reachable any more
and we have got memory leak.

Let's re-add 'ref' with corrected name to loose cache instead of
'new_ref' and free 'new_ref' properly.

'rollback' path seems leak too. git_reference_rename() need to be rewritten
for proper resource management.

Signed-off-by: Kirill A. Shutemov <9b153e80bc985b32d577460a8a24e398d4182978@shutemov.name>

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