On Mon, May 11, 2009 at 03:56:35PM +0200, Pritesh Kothari wrote:
> > [PATCH 1/3]: contains support for vrdp/sdl/gui while
defining a machine.
+
+ if ((def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL)
&& (sdlPresent == 0)) {
+ sdlPresent = 1;
+ sdlDisplay = strdup(def->graphics[i]->data.sdl.display);
+ if (sdlDisplay == NULL) {
+ vboxError(conn, VIR_ERR_SYSTEM_ERROR, "%s",
"strdup failed");
+ /* just don't go to cleanup yet as it is ok to have
+ * sdlDisplay as NULL and we check it below if it
+ * exist and then only use it there
+ */
+ }
+ }
This wasn't exactly what I anticipated. It intended that it should report
the error *and* return as an error to the caller, rather than carrying on.
That said, I notice that none of the existing code we have committed for
VirtualBox driver deals with OOM on strdup() calls, so this patch is not
making things any worse. Thus I think we can commit these patches and
fix all the strdup calls in one go, later.
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|