[Libreoffice-commits] .: odk/source
Caolán McNamara
caolan at kemper.freedesktop.org
Sun Oct 31 13:38:58 PDT 2010
odk/source/unoapploader/unx/unoapploader.c | 6 ++++--
odk/source/unoapploader/win/unoapploader.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
New commits:
commit 6e8b7533646f9326763f33f68f2d10b0030b698f
Author: Gert Faller <gertfaller at aliceadsl.fr>
Date: Sun Oct 31 20:38:51 2010 +0000
fix cppcheck warnings
diff --git a/odk/source/unoapploader/unx/unoapploader.c b/odk/source/unoapploader/unx/unoapploader.c
index 3cc214d..a36f8fd 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 fb16aab..b4897df 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();
More information about the Libreoffice-commits
mailing list