bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] Add the ``--mount'' command line option.


From: olafBuddenhagen
Subject: Re: [PATCH 1/3] Add the ``--mount'' command line option.
Date: Fri, 7 Aug 2009 21:30:22 +0200
User-agent: Mutt/1.5.19 (2009-01-05)

Hi,

On Mon, Aug 03, 2009 at 08:41:15PM +0300, Sergiu Ivanov wrote:

> +      if ((err = asprintf (&buf, "%s=\"%s\"", OPT_LONG (OPT_LONG_MOUNT),
> +                        mountee_cl)) == -1)
> +     {
> +       free (mountee_cl);
> +       return ENOMEM;
> +     }
> +
> +      err = argz_add (argz, argz_len, buf);
> +
> +      free (buf);
> +      free (mountee_cl);

You ignored my previous remark: please handle the error condition the same as
in other parts of the function!

To be more specific, a few lines below we have this code:

            char *buf = NULL;
            if ((err = asprintf (&buf, "%s=%s", OPT_LONG (OPT_LONG_PRIORITY),
                      ulfs->priority)) != -1)
              {
                err = argz_add (argz, argz_len, buf);
                free (buf);
              }

It does exactly the same -- please don't write it differently.

(This variant is more concise too, and thus more elegant. It avoids the need
for the explicit return and additional free().)

-antrik-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]