[PATCH 4/6] xserver: Memory leak fixes (configAddDevice)

Jesse Barnes jbarnes at virtuousgeek.org
Wed Mar 28 17:00:46 PDT 2007


On Wednesday, March 28, 2007 3:09 pm Magnus Vigerlöf wrote:
> diff --git a/config/config.c b/config/config.c
> index 02c2f23..4462da6 100644
> --- a/config/config.c
> +++ b/config/config.c
> @@ -110,6 +110,11 @@ configAddDevice(DBusMessage *message, DB
>
>      options->key = xstrdup("_source");
>      options->value = xstrdup("client/dbus");
> +    if(!options->key || !options->value) {
> +        ErrorF("[config] couldn't allocate first key/value pair\n");
> +        ret = BadAlloc;
> +        goto unwind;
> +    }

Is the ErrorF really necessary here?  Shouldn't the caller be notifying 
the user of problems rather than internal library code like this?  I 
guess it's all over in this code though, so... looks good.

Jesse



More information about the xorg mailing list