msvcrt: Remove redundant NULL checks before MSVCRT_free. It's only
a wrapper around HeapFree and the ANSI-C free function
ignores NULL anyway. Found by Smatch.
Michael Stefaniuc
mstefani at redhat.de
Tue Aug 8 18:17:41 CDT 2006
---
dlls/msvcrt/console.c | 3 +--
dlls/msvcrt/cpp.c | 3 +--
dlls/msvcrt/exit.c | 3 +--
dlls/msvcrt/file.c | 7 ++-----
dlls/msvcrt/process.c | 7 +++----
5 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/dlls/msvcrt/console.c b/dlls/msvcrt/console.c
index 612c65d..013ed54 100644
--- a/dlls/msvcrt/console.c
+++ b/dlls/msvcrt/console.c
@@ -231,8 +231,7 @@ int CDECL _kbhit(void)
break;
}
}
- if (ir)
- MSVCRT_free(ir);
+ MSVCRT_free(ir);
}
UNLOCK_CONSOLE;
return retval;
diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c
index 461380e..5ea595d 100644
--- a/dlls/msvcrt/cpp.c
+++ b/dlls/msvcrt/cpp.c
@@ -544,8 +544,7 @@ DEFINE_THISCALL_WRAPPER(MSVCRT_type_info
void __stdcall MSVCRT_type_info_dtor(type_info * _this)
{
TRACE("(%p)\n", _this);
- if (_this->name)
- MSVCRT_free(_this->name);
+ MSVCRT_free(_this->name);
}
/******************************************************************
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index 0c670aa..34e97e4 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -219,8 +219,7 @@ MSVCRT__onexit_t CDECL MSVCRT__onexit(MS
}
memcpy (newtable, MSVCRT_atexit_table, MSVCRT_atexit_table_size);
MSVCRT_atexit_table_size += 32;
- if (MSVCRT_atexit_table)
- MSVCRT_free (MSVCRT_atexit_table);
+ MSVCRT_free (MSVCRT_atexit_table);
MSVCRT_atexit_table = newtable;
}
MSVCRT_atexit_table[MSVCRT_atexit_registered] = func;
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 3b3a6de..9fe09dd 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -2040,11 +2040,8 @@ int CDECL MSVCRT_fclose(MSVCRT_FILE* fil
int r, flag;
flag = file->_flag;
- if (file->_tmpfname)
- {
- MSVCRT_free(file->_tmpfname);
- file->_tmpfname = NULL;
- }
+ MSVCRT_free(file->_tmpfname);
+ file->_tmpfname = NULL;
/* flush stdio buffers */
if(file->_flag & MSVCRT__IOWRT)
MSVCRT_fflush(file);
diff --git a/dlls/msvcrt/process.c b/dlls/msvcrt/process.c
index 7aa01ff..85a1e6c 100644
--- a/dlls/msvcrt/process.c
+++ b/dlls/msvcrt/process.c
@@ -371,7 +371,7 @@ MSVCRT_intptr_t CDECL _spawnle(int flags
ret = msvcrt_spawn(flags, name, args, envs);
MSVCRT_free(args);
- if (envs) MSVCRT_free(envs);
+ MSVCRT_free(envs);
return ret;
}
@@ -427,7 +427,7 @@ MSVCRT_intptr_t CDECL _spawnlpe(int flag
ret = msvcrt_spawn(flags, fullname[0] ? fullname : name, args, envs);
MSVCRT_free(args);
- if (envs) MSVCRT_free(envs);
+ MSVCRT_free(envs);
return ret;
}
@@ -482,8 +482,7 @@ MSVCRT_intptr_t CDECL _spawnve(int flags
ret = msvcrt_spawn(flags, fullname, args, envs);
MSVCRT_free(args);
}
- if (envs)
- MSVCRT_free(envs);
+ MSVCRT_free(envs);
return ret;
}
--
1.4.1
--
Michael Stefaniuc Tel.: +49-711-96437-199
Sr. Network Engineer Fax.: +49-711-96437-111
Red Hat GmbH Email: mstefani at redhat.com
Hauptstaetterstr. 58 http://www.redhat.de/
D-70178 Stuttgart
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060809/05195660/attachment.pgp
More information about the wine-patches
mailing list