Janitorial: Remove remaining NULL checks before free() (found by
Smatch).
Michael Stefaniuc
mstefani at redhat.de
Tue Sep 5 16:25:11 CDT 2006
---
dlls/itss/chm_lib.c | 3 +--
dlls/itss/lzx.c | 3 +--
dlls/msvcrt/tests/file.c | 6 +++---
libs/wpp/ppl.l | 14 +++++---------
libs/wpp/wpp.c | 4 ++--
programs/taskmgr/perfdata.c | 8 ++------
6 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/dlls/itss/chm_lib.c b/dlls/itss/chm_lib.c
index 190dea7..8e3a75e 100644
--- a/dlls/itss/chm_lib.c
+++ b/dlls/itss/chm_lib.c
@@ -805,8 +805,7 @@ void chm_close(struct chmFile *h)
h->cache_blocks = NULL;
}
- if (h->cache_block_indices)
- free(h->cache_block_indices);
+ free(h->cache_block_indices);
h->cache_block_indices = NULL;
free(h);
diff --git a/dlls/itss/lzx.c b/dlls/itss/lzx.c
index 927199a..cfafea0 100644
--- a/dlls/itss/lzx.c
+++ b/dlls/itss/lzx.c
@@ -208,8 +208,7 @@ void LZXteardown(struct LZXstate *pState
{
if (pState)
{
- if (pState->window)
- free(pState->window);
+ free(pState->window);
free(pState);
}
}
diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c
index 470a9e9..d22792e 100644
--- a/dlls/msvcrt/tests/file.c
+++ b/dlls/msvcrt/tests/file.c
@@ -366,8 +366,8 @@ #define LLEN 512
}
ok(!(diff_found), "fgetwc difference found in BINARY mode\n");
ok(*wptr == '\n', "Should get newline\n");
-
- if(mytextW) free (mytextW);
+
+ free(mytextW);
fclose(tempfh);
unlink(tempf);
}
@@ -463,7 +463,7 @@ static void test_file_put_get( void )
diff_found |= (*aptr != *wptr);
}
ok(!(diff_found), "fgetwc doesn't strip CR in TEXT mode\n");
- if(mytextW) free (mytextW);
+ free(mytextW);
fclose(tempfh);
unlink(tempf);
}
diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l
index d62cf1d..51f80e3 100644
--- a/libs/wpp/ppl.l
+++ b/libs/wpp/ppl.l
@@ -1249,11 +1249,10 @@ static bufferstackentry_t *pop_buffer(vo
if(pp_status.debug)
fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", pp_status.input, pp_status.line_number, pp_incl_state.ppp, iep->filename);
}
- else if(bufferstack[bufferstackidx].include_filename)
+ else
free(bufferstack[bufferstackidx].include_filename);
}
- if(pp_incl_state.ppp)
- free(pp_incl_state.ppp);
+ free(pp_incl_state.ppp);
pp_incl_state = bufferstack[bufferstackidx].incl;
pass_data = bufferstack[bufferstackidx].pass_data;
@@ -1320,12 +1319,9 @@ static void free_macro(macexpstackentry_
for(i = 0; i < mep->nargs; i++)
free(mep->args[i]);
- if(mep->args)
- free(mep->args);
- if(mep->nnls)
- free(mep->nnls);
- if(mep->curarg)
- free(mep->curarg);
+ free(mep->args);
+ free(mep->nnls);
+ free(mep->curarg);
free(mep);
}
diff --git a/libs/wpp/wpp.c b/libs/wpp/wpp.c
index 8e34264..0865960 100644
--- a/libs/wpp/wpp.c
+++ b/libs/wpp/wpp.c
@@ -80,7 +80,7 @@ void wpp_add_define( const char *name, c
{
if (!strcmp( def->name, name ))
{
- if (def->value) free( def->value );
+ free( def->value );
def->value = pp_xstrdup(value);
return;
}
@@ -103,7 +103,7 @@ void wpp_del_define( const char *name )
{
if (!strcmp( def->name, name ))
{
- if (def->value) free( def->value );
+ free( def->value );
def->value = NULL;
return;
}
diff --git a/programs/taskmgr/perfdata.c b/programs/taskmgr/perfdata.c
index 2b4a101..6a88fa3 100644
--- a/programs/taskmgr/perfdata.c
+++ b/programs/taskmgr/perfdata.c
@@ -178,9 +178,7 @@ void PerfDataRefresh(void)
/*
* Save system processor time info
*/
- if (SystemProcessorTimeInfo) {
- free(SystemProcessorTimeInfo);
- }
+ free(SystemProcessorTimeInfo);
SystemProcessorTimeInfo = SysProcessorTimeInfo;
/*
@@ -231,9 +229,7 @@ void PerfDataRefresh(void)
}
/* Now alloc a new PERFDATA array and fill in the data */
- if (pPerfDataOld) {
- free(pPerfDataOld);
- }
+ free(pPerfDataOld);
pPerfDataOld = pPerfData;
pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount);
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
--
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/20060905/9cf3e203/attachment.pgp
More information about the wine-patches
mailing list