make-alpha
[Top][All Lists]
Advanced

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

Re: New patch for user defined out of date.


From: Jim Meyering
Subject: Re: New patch for user defined out of date.
Date: Tue, 03 Jul 2007 15:45:36 +0200

Hi Ramón,

I spotted a couple of things:

"Ramón García" <address@hidden> wrote:
> Sorry, forgot to attach the patch.
...
> +  if (old_value_size == new_value_size &&
> +      (old_value_size == 0 || memcmp(old_value, new_value, old_value_size) 
> == 0)) {
> +    result = o;
> +  } else {
> +    if (file != NULL) {
> +      fclose(file);
> +    }
> +    file = fopen(filename, "w");

If open fails, file == NULL, ...

> +    fwrite(new_value, 1, new_value_size, file);

...in which case the above would segfault.

> +    result = variable_buffer_output(o, "true", sizeof("true"));
> +  }
> +
> +  if (old_value != NULL) {
> +    free(old_value);
> +  }
> +  if (file != NULL) {
> +    fclose(file);
> +  }

Please check for (and diagnose) all fopen, fwrite and fclose failures.




reply via email to

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