Code fixes

Various code fixes, mostly discovered by MSVC code static analyzer .
I got this generated code: 
```` C++
    PyObject* result;

    // transform the result
    

    WhichAlternative pos = apiResult.which();

    if (pos != XBMCAddon::none)
    { 
      if (pos == XBMCAddon::first)
      {
        std::string & entry1 = apiResult.former();
        {
          
result = PyString_FromStringAndSize(entry1.c_str(), entry1.length());

        }
      }

      if (pos == XBMCAddon::second)
      {
        std::vector< XBMCAddon::String  > & entry1 = apiResult.later();
        {
          


    result = PyList_New(0);

      for (std::vector<XBMCAddon::String >::iterator iter = entry1.begin(); iter != entry1.end(); ++iter)
      {
        std::string & entry2 = *iter;
        PyObject* pyentry2;
        
pyentry2 = PyString_FromStringAndSize(entry2.c_str(), entry2.length());

        PyList_Append(result, pyentry2);
        Py_DECREF(pyentry2);
      }


        }
      }

    }
    else
    { 
      result = Py_None;
    }


    return result; 
````
`Py_None` is used here.
I don't know what is more correct for this template.