summaryrefslogtreecommitdiff
path: root/utils/rbutilqt/base/bootloaderinstallipod.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rbutilqt/base/bootloaderinstallipod.cpp')
-rw-r--r--utils/rbutilqt/base/bootloaderinstallipod.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/utils/rbutilqt/base/bootloaderinstallipod.cpp b/utils/rbutilqt/base/bootloaderinstallipod.cpp
index f94813f99f..d08cc22339 100644
--- a/utils/rbutilqt/base/bootloaderinstallipod.cpp
+++ b/utils/rbutilqt/base/bootloaderinstallipod.cpp
@@ -28,10 +28,6 @@
28BootloaderInstallIpod::BootloaderInstallIpod(QObject *parent) 28BootloaderInstallIpod::BootloaderInstallIpod(QObject *parent)
29 : BootloaderInstallBase(parent) 29 : BootloaderInstallBase(parent)
30{ 30{
31 (void)parent;
32 // initialize sector buffer. The sector buffer is part of the ipod_t
33 // structure, so a second instance of this class will have its own buffer.
34 ipod_alloc_buffer(&ipod, BUFFER_SIZE);
35} 31}
36 32
37 33
@@ -45,11 +41,18 @@ BootloaderInstallIpod::~BootloaderInstallIpod()
45 41
46bool BootloaderInstallIpod::install(void) 42bool BootloaderInstallIpod::install(void)
47{ 43{
44 // initialize sector buffer. The sector buffer is part of the ipod_t
45 // structure, so a second instance of this class will have its own buffer.
46 if(ipod.sectorbuf == nullptr) {
47 ipod_alloc_buffer(&ipod, BUFFER_SIZE);
48 }
49
48 if(ipod.sectorbuf == nullptr) { 50 if(ipod.sectorbuf == nullptr) {
49 emit logItem(tr("Error: can't allocate buffer memory!"), LOGERROR); 51 emit logItem(tr("Error: can't allocate buffer memory!"), LOGERROR);
50 emit done(true); 52 emit done(true);
51 return false; 53 return false;
52 } 54 }
55
53 // save buffer pointer before cleaning up ipod_t structure 56 // save buffer pointer before cleaning up ipod_t structure
54 unsigned char* sb = ipod.sectorbuf; 57 unsigned char* sb = ipod.sectorbuf;
55 memset(&ipod, 0, sizeof(struct ipod_t)); 58 memset(&ipod, 0, sizeof(struct ipod_t));