On Fri, 2016-03-04 at 16:42 -0800, David Decotigny wrote:
> From: David Decotigny <de...@googlers.com>
> 
> The 'regs' pointer is owned by do_gregs(), but updated internally inside
> dump_regs() without propagating it back to do_gregs(): later free(regs)
> in do_gregs() reclaims the wrong area. This commit moves the realloc()
> inside do_gregs().

Wow, how did we ever get away with this?

Maybe no-one ever used this feature - it certainly makes very little
sense to save a register dump without the driver name or version
number, and then to assume that a loaded register dump matches the
running driver!

[...]
> @@ -2711,7 +2691,31 @@ static int do_gregs(struct cmd_context *ctx)
>               free(regs);
>               return 74;
>       }
> -     if (dump_regs(gregs_dump_raw, gregs_dump_hex, gregs_dump_file,
> +
> +     if ((!gregs_dump_raw) && (NULL != gregs_dump_file)) {
[...]

Redundant parentheses, and the comparison is written the wrong way
round.

Ben.

-- 
Ben Hutchings
The most exhausting thing in life is being insincere. - Anne Morrow Lindberg

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to