Apply fix for static analysis (scan-build) detection of a potential security issue (not checking the return value from setuid).

Fixes #11549
Fix static analysis detected error regarding dead assignment

In v4lchannel.cpp, the int field is assigned a value, and
never used before a later assignment.  Move the declaration
and assignment to the code fragment where it is used (as
with some other existing variables).  This resolves the
static analysis detected error.

Fixes #11551
Fix memory leak in MNV NetTree. Coverity 1026723
Fix GCC warning about initialisation order in MythBrowser
Update unzip.c/h in MythGame to version 1.01h from 2010, replacing version 0.15 beta from 1998
Add a README to mythgame's new external directory
Initialise some member variables in MythGallery. Coverity 1026728, 1026729
Fix missing breaks in switch. Coverity 700445-700447
Fix copy/paste error in FilterManager. Coverity 746767
Fix enum values being mixed up in TVBrowseHelper. Coverity 700462
Stop passing around ChannelChangeDirection enum values as ints which defeats the point of using enums in the first place.
In MHOctetString always allocate strLen+1 for null termination.

Coverity 746827
Patch for zero length malloc and check for malloc success

There is a feasible code path such that the string will
have a length of zero.  Malloc of a zero length has a
implementation dependent result (i.e. possible invalid
memory pointer).  Add one to the requested length to
eliminate the abiguity.  In addition, check the return
from malloc to insure it was successful.
(cherry picked from commit 28a77c36e2d320fa1304ad3822d5359b05af07a0)

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>

Fixes #11570
Initialize chanid in mythtranscode

Static analysis (scan-build) detects that the variable
chanid could be used without initialization.  This is
actually a false positive, since the use is protected
by the found_chanid variable, but initializing the
variable should be benign, and eliminates that static
analysis detected issue.
(cherry picked from commit 49617bc0c174be8b58e37ded693aa8d037ba7975)

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>

Fixes #11571
Check the return value of query.exec in dbutil.cpp

Fixes coverity 703634
(cherry picked from commit c45db226e673d4c890a092c7c76bc35266ec3996)

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>

Fixes #11567
Workaround QT ISO date parsing issue in mythfilldatabase. Fixes #11538

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
Fix use after free (realloc) in ParseText.cpp

Static analysis detected a use after free (realloc).  The
member variable should use the new string address, and it
is assigned the new string address after the usage.  This
looks to be a copy/paste error sometime in the past.  In
addition, follow the stated convention and null terminate
the string, just in case.
(cherry picked from commit df4aef6acf73e31f6399ce4c30c2d508e26c72a1)

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>

Fixes #11556
Patch for (potential) uninitalized variable num_lines

Static analysis indicates that there is a feasible
code path in LayoutParagraphs (called in GetNarrowWidth)
which will not result in calling Layout which will
initialize the variable num_lines.  Initialize the
variable num_lines just in case (and make the
analyzer happy).
(cherry picked from commit a5388fb30e8fce9b8875563d3b1382a2888fcc2c)

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>

Fixes #11553
Fix static analysis detected use without assignment

In ClassicCommDetector.cpp, static analysis indicates that
the variable currentFrameNumber could be used without
previously assigning it a value if certain code feasible
code paths are taken.  Assign it the value 0 at declaration.
(cherry picked from commit d2a021c29cf7d8bb4c13dd340654e61b4a16c8da)

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>

Fixes #11552
Check the return code from setsockopt (in lirc.cpp)

Static analysis (coverity) identified that the return code
from setsockopt was not checked.  This patch checks the
return code, with a log message if the setting fails.
(cherry picked from commit 0ae45b8598110898f4779f3bdc826e1ce5abb005)

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>

Fixes #11550