Change source to be a unique_ptr.
The current code keeps a pointer to a local variable which doesn't
work too well. Change this to a unique_ptr and allocate the source
object that will be used instead.
Test: All unit tests pass.
Test: fastboot -w flashall on a mokey which crashed without this change.
Change-Id: Ief5437374181e514928c45dd540b42898901a137
diff --git a/fastboot/fastboot.h b/fastboot/fastboot.h
index 4859ceb..cd7bc2d 100644
--- a/fastboot/fastboot.h
+++ b/fastboot/fastboot.h
@@ -28,6 +28,7 @@
#pragma once
#include <functional>
+#include <memory>
#include <string>
#include "fastboot_driver_interface.h"
#include "filesystem.h"
@@ -89,7 +90,7 @@
// If the image uses the default slot, or the user specified "all", then
// the paired string will be empty. If the image requests a specific slot
// (for example, system_other) it is specified instead.
- ImageSource* source;
+ std::unique_ptr<ImageSource> source;
bool wants_wipe = false;
bool skip_reboot = false;
bool wants_set_active = false;