daemon: Fix possible leak and unclear/undefined free behavior
daemon: Fix possible leak and unclear/undefined free behavior

Some versions of gcc complain about this code, as it's using the
cleanup attribute in a loop. Make the code clearer and defined.

Reviewed-by: Marius Vollmer <bb11c6e942c5cc765df5f04da146b3198127a7a3@redhat.com>

nmav/cockpit,moraleslazaro/cockpit,stefwalter/cockpit,moolitayer/cockpit,fridex/cockpit,vbatts/cockpit,mvollmer/cockpit,matobet/cockpit,garrett/cockpit,moolitayer/cockpit,Scribery/cockpit,michalskrivanek/cockpit,harishanand95/cockpit,deryni/cockpit,mareklibra/cockpit,arilivigni/cockpit,xhad/cockpit,deryni/cockpit,darioajr/cockpit,harishanand95/cockpit,sgallagher/cockpit,larsu/cockpit,vbatts/cockpit,Armstrong1992/cockpit,netzvieh/cockpit,nmav/cockpit,SotolitoLabs/cockpit,netzvieh/cockpit,garrett/cockpit,larsu/cockpit,firebitsbr/cockpit,deryni/cockpit,sgallagher/cockpit,larskarlitski/cockpit,kkaempf/cockpit,larsu/cockpit,garrett/cockpit,petervo/cockpit,petervo/cockpit,haiyangd/cockpit_view,zigitax/cockpit,michalskrivanek/cockpit,haiyangd/cockpit_view,martinpitt/cockpit,mareklibra/cockpit,dperpeet/cockpit,fridex/cockpit,darioajr/cockpit,xhad/cockpit,deryni/cockpit,larskarlitski/cockpit,larskarlitski/cockpit,Armstrong1992/cockpit,FireDrunk/cockpit,fridex/cockpit,larsu/cockpit,jscotka/cockpit,larsu/cockpit,mvollmer/cockpit,cockpit-project/cockpit,andreasn/cockpit,sgallagher/cockpit,sub-mod/cockpit,moolitayer/cockpit,mvollmer/cockpit,Thermionix/cockpit,netzvieh/cockpit,Thermionix/cockpit,mareklibra/cockpit,larsu/cockpit,sgallagher/cockpit,cockpituous/cockpit,dperpeet/cockpit,andreasn/cockpit,maxamillion/cockpit,zigitax/cockpit,harishanand95/cockpit,arilivigni/cockpit,vanloswang/cockpit,dperpeet/cockpit,fridex/cockpit,vanloswang/cockpit,mvollmer/cockpit,SotolitoLabs/cockpit,larskarlitski/cockpit,mvollmer/cockpit,FireDrunk/cockpit,matobet/cockpit,andreasn/cockpit,garrett/cockpit,darioajr/cockpit,mareklibra/cockpit,xhad/cockpit,sub-mod/cockpit,SotolitoLabs/cockpit,dperpeet/cockpit,sub-mod/cockpit,vanloswang/cockpit,larskarlitski/cockpit,Scribery/cockpit,Armstrong1992/cockpit,sgallagher/cockpit,vbatts/cockpit,jscotka/cockpit,haiyangd/cockpit_view,cockpituous/cockpit,moraleslazaro/cockpit,dperpeet/cockpit,dperpeet/cockpit,Scribery/cockpit,petervo/cockpit,stefwalter/cockpit,xhad/cockpit,FireDrunk/cockpit,harishanand95/cockpit,haiyangd/cockpit_view,evol262/cockpit,Thermionix/cockpit,vanloswang/cockpit,Armstrong1992/cockpit,xhad/cockpit,firebitsbr/cockpit,firebitsbr/cockpit,martinpitt/cockpit,harishanand95/cockpit,Scribery/cockpit,stefwalter/cockpit,michalskrivanek/cockpit,cockpit-project/cockpit,nmav/cockpit,FireDrunk/cockpit,arilivigni/cockpit,zigitax/cockpit,harishanand95/cockpit,netzvieh/cockpit,stefwalter/cockpit,cockpituous/cockpit,moraleslazaro/cockpit,arilivigni/cockpit,denysvitali/cockpit,SotolitoLabs/cockpit,larskarlitski/cockpit,Scribery/cockpit,vanloswang/cockpit,stefwalter/cockpit,moraleslazaro/cockpit,kkaempf/cockpit,fridex/cockpit,matobet/cockpit,moraleslazaro/cockpit,Thermionix/cockpit,darioajr/cockpit,vanloswang/cockpit,stefwalter/cockpit,martinpitt/cockpit,vbatts/cockpit,petervo/cockpit,mareklibra/cockpit,arilivigni/cockpit,arilivigni/cockpit,cockpit-project/cockpit,maxamillion/cockpit,netzvieh/cockpit,cockpituous/cockpit,evol262/cockpit,jscotka/cockpit,evol262/cockpit,deryni/cockpit,evol262/cockpit,mareklibra/cockpit,netzvieh/cockpit,zigitax/cockpit,martinpitt/cockpit,sub-mod/cockpit,vbatts/cockpit,andreasn/cockpit,SotolitoLabs/cockpit,harishanand95/cockpit,darioajr/cockpit,moolitayer/cockpit,zigitax/cockpit,sub-mod/cockpit,mareklibra/cockpit,SotolitoLabs/cockpit,sgallagher/cockpit,michalskrivanek/cockpit,jscotka/cockpit,nmav/cockpit,kkaempf/cockpit,Armstrong1992/cockpit,andreasn/cockpit,firebitsbr/cockpit,andreasn/cockpit,cockpituous/cockpit,moraleslazaro/cockpit,xhad/cockpit,arilivigni/cockpit,cockpit-project/cockpit,deryni/cockpit,xhad/cockpit,larskarlitski/cockpit,cockpit-project/cockpit,matobet/cockpit,cockpituous/cockpit,petervo/cockpit,maxamillion/cockpit,dperpeet/cockpit,firebitsbr/cockpit,nmav/cockpit,martinpitt/cockpit,andreasn/cockpit,maxamillion/cockpit,denysvitali/cockpit,jscotka/cockpit,maxamillion/cockpit,Thermionix/cockpit,denysvitali/cockpit,denysvitali/cockpit,Scribery/cockpit,fridex/cockpit,vbatts/cockpit,moraleslazaro/cockpit,matobet/cockpit,matobet/cockpit,kkaempf/cockpit,evol262/cockpit,petervo/cockpit,deryni/cockpit,FireDrunk/cockpit,jscotka/cockpit,michalskrivanek/cockpit,michalskrivanek/cockpit,michalskrivanek/cockpit,stefwalter/cockpit,Scribery/cockpit,garrett/cockpit,kkaempf/cockpit,petervo/cockpit,moolitayer/cockpit,denysvitali/cockpit,haiyangd/cockpit_view,Thermionix/cockpit,vanloswang/cockpit,SotolitoLabs/cockpit,evol262/cockpit,sgallagher/cockpit