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

This commit is contained in:
Michael Stefaniuc 2006-10-09 23:35:08 +02:00 committed by Alexandre Julliard
parent 0fb444b58c
commit 173f7bd26c
8 changed files with 18 additions and 32 deletions

View File

@ -805,7 +805,6 @@ void chm_close(struct chmFile *h)
h->cache_blocks = NULL; h->cache_blocks = NULL;
} }
if (h->cache_block_indices)
free(h->cache_block_indices); free(h->cache_block_indices);
h->cache_block_indices = NULL; h->cache_block_indices = NULL;

View File

@ -208,7 +208,6 @@ void LZXteardown(struct LZXstate *pState)
{ {
if (pState) if (pState)
{ {
if (pState->window)
free(pState->window); free(pState->window);
free(pState); free(pState);
} }

View File

@ -385,7 +385,7 @@ static void test_fgetwc( void )
ok(!(diff_found), "fgetwc difference found in BINARY mode\n"); ok(!(diff_found), "fgetwc difference found in BINARY mode\n");
ok(*wptr == '\n', "Should get newline\n"); ok(*wptr == '\n', "Should get newline\n");
if(mytextW) free (mytextW); free(mytextW);
fclose(tempfh); fclose(tempfh);
unlink(tempf); unlink(tempf);
} }
@ -481,7 +481,7 @@ static void test_file_put_get( void )
diff_found |= (*aptr != *wptr); diff_found |= (*aptr != *wptr);
} }
ok(!(diff_found), "fgetwc doesn't strip CR in TEXT mode\n"); ok(!(diff_found), "fgetwc doesn't strip CR in TEXT mode\n");
if(mytextW) free (mytextW); free(mytextW);
fclose(tempfh); fclose(tempfh);
unlink(tempf); unlink(tempf);
} }

View File

@ -231,7 +231,6 @@ FreeSavedImages(GifFileType * GifFile) {
sp->ImageDesc.ColorMap = NULL; sp->ImageDesc.ColorMap = NULL;
} }
if (sp->RasterBits)
free(sp->RasterBits); free(sp->RasterBits);
if (sp->ExtensionBlocks) if (sp->ExtensionBlocks)
@ -962,10 +961,8 @@ DGifCloseFile(GifFileType * GifFile) {
GifFile->SColorMap = NULL; GifFile->SColorMap = NULL;
} }
if (Private) {
free(Private); free(Private);
Private = NULL; Private = NULL;
}
if (GifFile->SavedImages) { if (GifFile->SavedImages) {
FreeSavedImages(GifFile); FreeSavedImages(GifFile);

View File

@ -1379,7 +1379,6 @@ buffer_resize(WINE_WAVEOUT* wwo, int len)
void *oldbuf = wwo->SoundBuffer; void *oldbuf = wwo->SoundBuffer;
memcpy(newbuf, oldbuf, wwo->BufferUsed); memcpy(newbuf, oldbuf, wwo->BufferUsed);
wwo->SoundBuffer = newbuf; wwo->SoundBuffer = newbuf;
if (oldbuf != NULL)
free(oldbuf); free(oldbuf);
} }

View File

@ -1249,10 +1249,9 @@ static bufferstackentry_t *pop_buffer(void)
if(pp_status.debug) 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); 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); 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; pp_incl_state = bufferstack[bufferstackidx].incl;
pass_data = bufferstack[bufferstackidx].pass_data; pass_data = bufferstack[bufferstackidx].pass_data;
@ -1320,11 +1319,8 @@ static void free_macro(macexpstackentry_t *mep)
for(i = 0; i < mep->nargs; i++) for(i = 0; i < mep->nargs; i++)
free(mep->args[i]); free(mep->args[i]);
if(mep->args)
free(mep->args); free(mep->args);
if(mep->nnls)
free(mep->nnls); free(mep->nnls);
if(mep->curarg)
free(mep->curarg); free(mep->curarg);
free(mep); free(mep);
} }

View File

@ -80,7 +80,7 @@ void wpp_add_define( const char *name, const char *value )
{ {
if (!strcmp( def->name, name )) if (!strcmp( def->name, name ))
{ {
if (def->value) free( def->value ); free( def->value );
def->value = pp_xstrdup(value); def->value = pp_xstrdup(value);
return; return;
} }
@ -103,7 +103,7 @@ void wpp_del_define( const char *name )
{ {
if (!strcmp( def->name, name )) if (!strcmp( def->name, name ))
{ {
if (def->value) free( def->value ); free( def->value );
def->value = NULL; def->value = NULL;
return; return;
} }

View File

@ -178,9 +178,7 @@ void PerfDataRefresh(void)
/* /*
* Save system processor time info * Save system processor time info
*/ */
if (SystemProcessorTimeInfo) {
free(SystemProcessorTimeInfo); free(SystemProcessorTimeInfo);
}
SystemProcessorTimeInfo = SysProcessorTimeInfo; SystemProcessorTimeInfo = SysProcessorTimeInfo;
/* /*
@ -231,9 +229,7 @@ void PerfDataRefresh(void)
} }
/* Now alloc a new PERFDATA array and fill in the data */ /* Now alloc a new PERFDATA array and fill in the data */
if (pPerfDataOld) {
free(pPerfDataOld); free(pPerfDataOld);
}
pPerfDataOld = pPerfData; pPerfDataOld = pPerfData;
pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount); pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount);
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer; pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;