Kaydet (Commit) e6c68c3e authored tarafından Gert Faller's avatar Gert Faller Kaydeden (comit) Caolán McNamara

fix cppcheck warnings

üst 8cad7d19
...@@ -146,13 +146,15 @@ int main( int argc, char *argv[] ) ...@@ -146,13 +146,15 @@ int main( int argc, char *argv[] )
libpath = NULL; libpath = NULL;
for (;;) { for (;;) {
size_t m; size_t m;
libpath = realloc(libpath, n); char * test = realloc(libpath, n);
if (libpath == NULL) { if (test == NULL) {
fprintf( fprintf(
stderr, stderr,
"Error: out of memory reading unoinfo output!\n"); "Error: out of memory reading unoinfo output!\n");
free(libpath);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
libpath = test;
m = fread(libpath + old, 1, n - old - 1, f); m = fread(libpath + old, 1, n - old - 1, f);
if (m != n - old - 1) { if (m != n - old - 1) {
if (ferror(f)) { if (ferror(f)) {
......
...@@ -152,13 +152,15 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, ...@@ -152,13 +152,15 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
CloseHandle(procinfo.hThread); CloseHandle(procinfo.hThread);
for (;;) { for (;;) {
DWORD m; DWORD m;
buf = realloc(buf, n); char * test = realloc(buf, n);
if (buf == NULL) { if (test == NULL) {
writeError( writeError(
"Error: out of memory reading unoinfo output!\n"); "Error: out of memory reading unoinfo output!\n");
closeErrorFile(); closeErrorFile();
free(buf);
return 1; return 1;
} }
buf = test;
if (!ReadFile(stdoutRead, buf + k, n - k, &m, NULL)) if (!ReadFile(stdoutRead, buf + k, n - k, &m, NULL))
{ {
DWORD err = GetLastError(); DWORD err = GetLastError();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment