Commit 173f7bd2 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

janitorial: Remove remaining NULL checks before free() (found by Smatch).

parent 0fb444b5
......@@ -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);
......
......@@ -208,8 +208,7 @@ void LZXteardown(struct LZXstate *pState)
{
if (pState)
{
if (pState->window)
free(pState->window);
free(pState->window);
free(pState);
}
}
......
......@@ -384,8 +384,8 @@ static void test_fgetwc( void )
}
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);
}
......@@ -481,7 +481,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);
}
......
......@@ -231,8 +231,7 @@ FreeSavedImages(GifFileType * GifFile) {
sp->ImageDesc.ColorMap = NULL;
}
if (sp->RasterBits)
free(sp->RasterBits);
free(sp->RasterBits);
if (sp->ExtensionBlocks)
FreeExtension(sp);
......@@ -962,10 +961,8 @@ DGifCloseFile(GifFileType * GifFile) {
GifFile->SColorMap = NULL;
}
if (Private) {
free(Private);
Private = NULL;
}
free(Private);
Private = NULL;
if (GifFile->SavedImages) {
FreeSavedImages(GifFile);
......
......@@ -1379,8 +1379,7 @@ buffer_resize(WINE_WAVEOUT* wwo, int len)
void *oldbuf = wwo->SoundBuffer;
memcpy(newbuf, oldbuf, wwo->BufferUsed);
wwo->SoundBuffer = newbuf;
if (oldbuf != NULL)
free(oldbuf);
free(oldbuf);
}
static int nas_add_buffer(WINE_WAVEOUT* wwo) {
......
......@@ -1249,11 +1249,10 @@ static bufferstackentry_t *pop_buffer(void)
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_t *mep)
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);
}
......
......@@ -80,7 +80,7 @@ void wpp_add_define( const char *name, const char *value )
{
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;
}
......
......@@ -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;
......
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