]> git.ozlabs.org Git - petitboot/commitdiff
discover/grub2: Fix free in load_env command
authorJeremy Kerr <jk@ozlabs.org>
Wed, 27 Nov 2013 11:43:25 +0000 (19:43 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 27 Nov 2013 11:43:25 +0000 (19:43 +0800)
We only need to free the buf if parser_request_file returned success.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/grub2/env.c

index c887c7511297c9829dab795c6cc9d84adce3401a..1c8635fbc924427b880ab518ff3e3ba7664dc259 100644 (file)
@@ -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;
 }