virtual-usb-printer: result should have same lifecycle as ipp_manager

IppManager has many IppAttributes, which hold a pointer into inside
*result, because Value operations return an internal memory address
rather than a copy.

BUG=chromium:1099111
TEST=printer.IPPUSBPPDNoCopies

Change-Id: I66da994dad9f5d4dc1e5cb1e58bfda7fe92ad971
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/virtual-usb-printer/+/2282875
Tested-by: Qijiang Fan <fqj@google.com>
Commit-Queue: Jesse Schettler <jschettler@chromium.org>
Reviewed-by: Sean Kau <skau@chromium.org>
Reviewed-by: Jesse Schettler <jschettler@chromium.org>
diff --git a/virtual_usb_printer.cc b/virtual_usb_printer.cc
index ea572d0..940e47b 100644
--- a/virtual_usb_printer.cc
+++ b/virtual_usb_printer.cc
@@ -138,6 +138,7 @@
 
   IppManager ipp_manager;
   // Load ipp attributes if |FLAGS_attributes_path| is set.
+  base::Optional<base::Value> result;
   if (!FLAGS_attributes_path.empty()) {
     base::Optional<std::string> attributes_contents =
         GetJSONContents(FLAGS_attributes_path);
@@ -146,7 +147,7 @@
                  << FLAGS_attributes_path;
       return 1;
     }
-    base::Optional<base::Value> result =
+    result =
         base::JSONReader::Read(*attributes_contents);
     if (!result) {
       LOG(ERROR) << "Failed to parse " << FLAGS_attributes_path;