diff options
-rw-r--r-- | rbutil/ipodpatcher/ipodpatcher.c | 2 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallipod.cpp | 12 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallsansa.cpp | 12 | ||||
-rw-r--r-- | rbutil/sansapatcher/sansapatcher.c | 2 |
4 files changed, 20 insertions, 8 deletions
diff --git a/rbutil/ipodpatcher/ipodpatcher.c b/rbutil/ipodpatcher/ipodpatcher.c index 73467dea34..dd650506a1 100644 --- a/rbutil/ipodpatcher/ipodpatcher.c +++ b/rbutil/ipodpatcher/ipodpatcher.c | |||
@@ -50,7 +50,7 @@ | |||
50 | 50 | ||
51 | int ipod_verbose = 0; | 51 | int ipod_verbose = 0; |
52 | 52 | ||
53 | unsigned char* ipod_sectorbuf; | 53 | unsigned char* ipod_sectorbuf = NULL; |
54 | 54 | ||
55 | /* The following string appears at the start of the firmware partition */ | 55 | /* The following string appears at the start of the firmware partition */ |
56 | static const char *apple_stop_sign = "{{~~ /-----\\ "\ | 56 | static const char *apple_stop_sign = "{{~~ /-----\\ "\ |
diff --git a/rbutil/rbutilqt/base/bootloaderinstallipod.cpp b/rbutil/rbutilqt/base/bootloaderinstallipod.cpp index e4a70e0cd6..f622225f22 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallipod.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallipod.cpp | |||
@@ -30,15 +30,21 @@ BootloaderInstallIpod::BootloaderInstallIpod(QObject *parent) | |||
30 | { | 30 | { |
31 | (void)parent; | 31 | (void)parent; |
32 | // initialize sector buffer. ipod_sectorbuf is defined in ipodpatcher. | 32 | // initialize sector buffer. ipod_sectorbuf is defined in ipodpatcher. |
33 | ipod_sectorbuf = NULL; | 33 | // The buffer itself is only present once, so make sure to not allocate |
34 | ipod_alloc_buffer(&ipod_sectorbuf, BUFFER_SIZE); | 34 | // it if it was already allocated. The application needs to take care |
35 | // no concurrent (i.e. multiple objects of this class running) requests | ||
36 | // are done. | ||
37 | if(ipod_sectorbuf == NULL) | ||
38 | ipod_alloc_buffer(&ipod_sectorbuf, BUFFER_SIZE); | ||
35 | } | 39 | } |
36 | 40 | ||
37 | 41 | ||
38 | BootloaderInstallIpod::~BootloaderInstallIpod() | 42 | BootloaderInstallIpod::~BootloaderInstallIpod() |
39 | { | 43 | { |
40 | if(ipod_sectorbuf) | 44 | if(ipod_sectorbuf) { |
41 | free(ipod_sectorbuf); | 45 | free(ipod_sectorbuf); |
46 | ipod_sectorbuf = NULL; | ||
47 | } | ||
42 | } | 48 | } |
43 | 49 | ||
44 | 50 | ||
diff --git a/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp b/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp index aab298ce95..19750446f6 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp | |||
@@ -30,15 +30,21 @@ BootloaderInstallSansa::BootloaderInstallSansa(QObject *parent) | |||
30 | (void)parent; | 30 | (void)parent; |
31 | // initialize sector buffer. sansa_sectorbuf is instantiated by | 31 | // initialize sector buffer. sansa_sectorbuf is instantiated by |
32 | // sansapatcher. | 32 | // sansapatcher. |
33 | sansa_sectorbuf = NULL; | 33 | // The buffer itself is only present once, so make sure to not allocate |
34 | sansa_alloc_buffer(&sansa_sectorbuf, BUFFER_SIZE); | 34 | // it if it was already allocated. The application needs to take care |
35 | // no concurrent (i.e. multiple objects of this class running) requests | ||
36 | // are done. | ||
37 | if(sansa_sectorbuf == NULL) | ||
38 | sansa_alloc_buffer(&sansa_sectorbuf, BUFFER_SIZE); | ||
35 | } | 39 | } |
36 | 40 | ||
37 | 41 | ||
38 | BootloaderInstallSansa::~BootloaderInstallSansa() | 42 | BootloaderInstallSansa::~BootloaderInstallSansa() |
39 | { | 43 | { |
40 | if(sansa_sectorbuf) | 44 | if(sansa_sectorbuf) { |
41 | free(sansa_sectorbuf); | 45 | free(sansa_sectorbuf); |
46 | sansa_sectorbuf = NULL; | ||
47 | } | ||
42 | } | 48 | } |
43 | 49 | ||
44 | 50 | ||
diff --git a/rbutil/sansapatcher/sansapatcher.c b/rbutil/sansapatcher/sansapatcher.c index 8d3191901a..015e5cbaf2 100644 --- a/rbutil/sansapatcher/sansapatcher.c +++ b/rbutil/sansapatcher/sansapatcher.c | |||
@@ -47,7 +47,7 @@ int sansa_verbose = 0; | |||
47 | and initialise it with sansa_alloc_buf() in main(). | 47 | and initialise it with sansa_alloc_buf() in main(). |
48 | */ | 48 | */ |
49 | 49 | ||
50 | unsigned char* sansa_sectorbuf; | 50 | unsigned char* sansa_sectorbuf = NULL; |
51 | 51 | ||
52 | static off_t filesize(int fd) { | 52 | static off_t filesize(int fd) { |
53 | struct stat buf; | 53 | struct stat buf; |