From: Jeremy Kerr Date: Wed, 27 Nov 2013 11:43:25 +0000 (+0800) Subject: discover/grub2: Fix free in load_env command X-Git-Tag: v1.0.0~302 X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=25e353275fb55192fbd80c3bbe012df17e35a09f discover/grub2: Fix free in load_env command We only need to free the buf if parser_request_file returned success. Signed-off-by: Jeremy Kerr --- diff --git a/discover/grub2/env.c b/discover/grub2/env.c index c887c75..1c8635f 100644 --- a/discover/grub2/env.c +++ b/discover/grub2/env.c @@ -84,10 +84,10 @@ int builtin_load_env(struct grub2_script *script, rc = parser_request_file(script->ctx, dev, envpath, &buf, &len); - if (!rc) + if (!rc) { rc = parse_buf_to_env(script, buf, len); - - talloc_free(buf); + talloc_free(buf); + } return 0; }