summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGert Faller <gertfaller@aliceadsl.fr>2010-10-31 20:38:51 +0000
committerCaolán McNamara <caolanm@redhat.com>2010-10-31 20:38:51 +0000
commit6e8b7533646f9326763f33f68f2d10b0030b698f (patch)
treee0e0de362ad401e053ed144e3d69073e7e21fa96
parentddb49cfcbeb9bbb34ee03b03ba0818602629afef (diff)
-rw-r--r--odk/source/unoapploader/unx/unoapploader.c6
-rw-r--r--odk/source/unoapploader/win/unoapploader.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/odk/source/unoapploader/unx/unoapploader.c b/odk/source/unoapploader/unx/unoapploader.c
index 3cc214d8..a36f8fdd 100644
--- a/odk/source/unoapploader/unx/unoapploader.c
+++ b/odk/source/unoapploader/unx/unoapploader.c
@@ -146,13 +146,15 @@ int main( int argc, char *argv[] )
libpath = NULL;
for (;;) {
size_t m;
- libpath = realloc(libpath, n);
- if (libpath == NULL) {
+ char * test = realloc(libpath, n);
+ if (test == NULL) {
fprintf(
stderr,
"Error: out of memory reading unoinfo output!\n");
+ free(libpath);
exit(EXIT_FAILURE);
}
+ libpath = test;
m = fread(libpath + old, 1, n - old - 1, f);
if (m != n - old - 1) {
if (ferror(f)) {
diff --git a/odk/source/unoapploader/win/unoapploader.c b/odk/source/unoapploader/win/unoapploader.c
index fb16aab6..b4897dff 100644
--- a/odk/source/unoapploader/win/unoapploader.c
+++ b/odk/source/unoapploader/win/unoapploader.c
@@ -152,13 +152,15 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
CloseHandle(procinfo.hThread);
for (;;) {
DWORD m;
- buf = realloc(buf, n);
- if (buf == NULL) {
+ char * test = realloc(buf, n);
+ if (test == NULL) {
writeError(
"Error: out of memory reading unoinfo output!\n");
closeErrorFile();
+ free(buf);
return 1;
}
+ buf = test;
if (!ReadFile(stdoutRead, buf + k, n - k, &m, NULL))
{
DWORD err = GetLastError();