Hi,

On 02/19/2012 03:19 PM, Marc-André Lureau wrote:
On Sun, Feb 19, 2012 at 12:50 AM, Hans de Goede<hdego...@redhat.com>  wrote:
+    if (!priv->host)
+        g_error("Out of memory allocating usbredirhost");

spice-gtk is a library, and should not abort a program using it.

Agreed.

However, if it's for memory allocation reasons, then it does that
already and it's the only reasonable thing to do.

Yes, the usbredirhost_open_full call can only fail if calloc returns
NULL.

I would prefer if it didn't call g_error() here.

I understand but given that:
1) This only happens on memory allocation errors
2) glib already does a g_error on memory allocation errors
   in other places
3) Doing other error handling is way more complicated

I believe that this is the best solution here.

Why is it not the policy of libusbredir to
abort if allocation failed?

Because libusbredirparser and libusbredirhost are meant to be
generic libraries which can be used in various places, including some
which may have a different oom handling policy.

Regards,

Hans
_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to