Commit Graph

7 Commits

Author SHA1 Message Date
John Ferlan
cfbbeb36cf xen_xm: Resolve Coverity USE_AFTER_FREE
If virDomainDiskDefFree(disk) is called in 'skipdisk:', then it's possible
to either return to skipdisk without reallocating a new disk (via the if
condition just prior) or to end the loop having deleted the disk. Since
virDomainDiskDefFree() does not pass by reference, disk isn't changed in
this context, thus the possible issue.
2014-08-27 12:52:27 -04:00
John Ferlan
0454f23c31 xen_common: Resolve Coverity USE_AFTER_FREE
There were two warnings in this module

  If the VIR_ALLOC_N(def->serials, 1) fails, then a virDomainChrDefFree(chr)
  is called and we jump to cleanup which makes the same call. Just remove
  the one after VIR_ALLOC_N()

  In the label "skipnic:" a virDomainNetDefFree(net) is made; however, if
  in going back to the top of the loop we jump back down to skipnic for any
  reason, the call will attempt to free an already freed structure since
  "net" was not passed by reference to virDomainNetDefFree().  Just set
  net = NULL in skipnic: to resolve the issue.
2014-08-27 12:52:27 -04:00
John Ferlan
c585334bdd xenconfig: Resolve Coverity RESOURCE_LEAK
Since '337a13628' - Coverity complains that 'net' is VIR_ALLOC()'d, but
on various 'cleanup' exit paths from the code there is no corresponding
cleanup.
2014-08-22 13:02:48 -04:00
Jim Fehlig
337a136282 src/xenconfig: move common parsing/formatting to xen_common
XM and XL config are very similar.  Disks are specified differently
in XL, but the old XM disk config is still supported by XL.  XL also
supports new config like spice that was never supported by XM.

This patch moves all the common parsing and formatting functions to
the new file xen_common.c and adapts the XM parser/formatter accordingly.
This restructuring paves way for introducing an XL parser/formatter in
the future.

While moving the code, fixup whitespace, comments, and style issues.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-08-18 20:47:38 -06:00
Kiarie Kahurani
f67bf6e9b5 src/xenconfig: wrap common formatting code
Wrap formatting code common to xm and xl in xenFormatConfigCommon
and export it.

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-08-18 20:37:07 -06:00
Kiarie Kahurani
512f673835 src/xenconfig: wrap common parsing code
Wrap parsing code common to xm and xl in xenParseConfigCommon
and export it.

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-08-18 20:36:56 -06:00
Jim Fehlig
870c90c70f xen: rename xenxs to xenconfig
src/xenxs contains parsing/formating functions for the various xen
config formats, and is better named src/xenconfig.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2014-08-18 20:36:24 -06:00