From 78b7f6e138c561ccc3082a93b155934b4b9c3649 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 8 Jun 2012 14:10:57 +0100 Subject: targetted revert of minor cppcheck cleanup Change-Id: Id3100ef8f8381bc05e5a01c56fc5d611094857bf --- odk/source/unoapploader/unx/unoapploader.c | 6 ++---- odk/source/unoapploader/win/unoapploader.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/odk/source/unoapploader/unx/unoapploader.c b/odk/source/unoapploader/unx/unoapploader.c index 90c1cd1493c0..e744f1be009f 100644 --- a/odk/source/unoapploader/unx/unoapploader.c +++ b/odk/source/unoapploader/unx/unoapploader.c @@ -148,15 +148,13 @@ int main( int argc, char *argv[] ) libpath = NULL; for (;;) { size_t m; - char * test = realloc(libpath, n); - if (test == NULL) { + libpath = realloc(libpath, n); + if (libpath == 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 8debafe0c25f..ca17ce7b2146 100644 --- a/odk/source/unoapploader/win/unoapploader.c +++ b/odk/source/unoapploader/win/unoapploader.c @@ -152,15 +152,13 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, CloseHandle(procinfo.hThread); for (;;) { DWORD m; - char * test = realloc(buf, n); - if (test == NULL) { + buf = realloc(buf, n); + if (buf == 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(); -- cgit v1.2.3