diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-17 11:15:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-17 11:15:15 +0000 |
commit | 152da8847e828b132c5753ae5f58e8272556d4ef (patch) | |
tree | 7c96822b3ea2dee6257071d557259177c11da6f0 /src/mir_core/memory.cpp | |
parent | 79c0e81fbfd1f933a1e251db23dc1fd537ddd239 (diff) |
some another leaks fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@4070 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core/memory.cpp')
-rw-r--r-- | src/mir_core/memory.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/mir_core/memory.cpp b/src/mir_core/memory.cpp index b8bf481aad..2f7467ccc4 100644 --- a/src/mir_core/memory.cpp +++ b/src/mir_core/memory.cpp @@ -144,52 +144,52 @@ MIR_C_CORE_DLL(void) mir_free(void* ptr) MIR_CORE_DLL(char*) mir_strdup(const char *str)
{
- if (str != NULL) {
- char *p = (char*)mir_alloc(strlen(str)+1);
- if (p)
- strcpy(p, str);
- return p;
- }
- return NULL;
+ if (str == NULL)
+ return NULL;
+
+ char *p = (char*)mir_alloc(strlen(str)+1);
+ if (p)
+ strcpy(p, str);
+ return p;
}
MIR_CORE_DLL(WCHAR*) mir_wstrdup(const WCHAR *str)
{
- if (str != NULL) {
- WCHAR *p = (WCHAR*)mir_alloc(sizeof(WCHAR)*(wcslen(str)+1));
- if (p)
- wcscpy(p, str);
- return p;
- }
- return NULL;
+ if (str == NULL)
+ return NULL;
+
+ WCHAR *p = (WCHAR*)mir_alloc(sizeof(WCHAR)*(wcslen(str)+1));
+ if (p)
+ wcscpy(p, str);
+ return p;
}
/******************************************************************************/
MIR_CORE_DLL(char*) mir_strndup(const char *str, size_t len)
{
- if (str != NULL && len != 0) {
- char *p = (char*)mir_alloc(len+1);
- if (p) {
- memcpy(p, str, len);
- p[ len ] = 0;
- }
- return p;
+ if (str == NULL || len == 0)
+ return NULL;
+
+ char *p = (char*)mir_alloc(len+1);
+ if (p) {
+ memcpy(p, str, len);
+ p[ len ] = 0;
}
- return NULL;
+ return p;
}
MIR_CORE_DLL(WCHAR*) mir_wstrndup(const WCHAR *str, size_t len)
{
- if (str != NULL && len != 0) {
- WCHAR *p = (WCHAR*)mir_alloc(sizeof(WCHAR)*(len+1));
- if (p) {
- memcpy(p, str, sizeof(WCHAR)*len);
- p[ len ] = 0;
- }
- return p;
+ if (str == NULL || len == 0)
+ return NULL;
+
+ WCHAR *p = (WCHAR*)mir_alloc(sizeof(WCHAR)*(len+1));
+ if (p) {
+ memcpy(p, str, sizeof(WCHAR)*len);
+ p[ len ] = 0;
}
- return NULL;
+ return p;
}
/******************************************************************************/
|