diff options
author | Gert Faller <gertfaller@aliceadsl.fr> | 2010-10-31 20:38:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-10-31 20:38:51 +0000 |
commit | e6c68c3eed472aef1c116d27ff6e35e52622463d (patch) | |
tree | 68d9fdb665561e88c4d165da7bc60d48afd1ffb4 /odk/source | |
parent | 8cad7d1947a02e28355c03b787df40052b48e4e4 (diff) |
fix cppcheck warnings
Notes
Notes:
split repo tag: sdk_LIBREOFFICE_3_3_FREEZE
Diffstat (limited to 'odk/source')
-rw-r--r-- | odk/source/unoapploader/unx/unoapploader.c | 6 | ||||
-rw-r--r-- | odk/source/unoapploader/win/unoapploader.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/odk/source/unoapploader/unx/unoapploader.c b/odk/source/unoapploader/unx/unoapploader.c index fb5e2dea3841..a44c01285918 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 6c197c21d9a1..ee806f1b4976 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(); |