Index: channels/chan_dahdi.c =================================================================== --- channels/chan_dahdi.c (revision 186562) +++ channels/chan_dahdi.c (working copy) @@ -9943,8 +9943,7 @@ if (!here && reloading != 1) { if (!(tmp = ast_calloc(1, sizeof(*tmp)))) { - if (tmp) - free(tmp); + free(tmp); return NULL; } ast_mutex_init(&tmp->lock); Index: channels/chan_console.c =================================================================== --- channels/chan_console.c (revision 186562) +++ channels/chan_console.c (working copy) @@ -837,8 +837,7 @@ } else ast_cli(a->fd, "No such extension '%s' in context '%s'\n", mye, myc); - if (s) - free(s); + free(s); unref_pvt(pvt); Index: apps/app_rpt.c =================================================================== --- apps/app_rpt.c (revision 186562) +++ apps/app_rpt.c (working copy) @@ -1957,7 +1957,12 @@ if (!myrpt->p.statpost_url) return; str = ast_malloc(strlen(pairs) + strlen(myrpt->p.statpost_url) + 200); astr = ast_strdup(myrpt->p.statpost_program); - if ((!str) || (!astr)) return; + if ((!str) || (!astr)) + { + ast_free(str); + ast_free(astr); + return; + } n = finddelim(astr,astrs,100); if (n < 1) return; ast_mutex_lock(&myrpt->statpost_lock); @@ -2895,12 +2900,8 @@ for(j = 0; j < numoflinks; j++){ /* ast_free() all link names */ ast_free(listoflinks[j]); } - if(called_number){ - ast_free(called_number); - } - if(lastdtmfcommand){ - ast_free(lastdtmfcommand); - } + ast_free(called_number); + ast_free(lastdtmfcommand); return RESULT_SUCCESS; } } @@ -3646,8 +3647,7 @@ if(res) break; } - if(p) - ast_free(p); + ast_free(p); if(!res) res = play_tone_pair(chan, 0, 0, 100, 0); /* This is needed to ensure the last tone segment is timed correctly */ @@ -3828,8 +3828,7 @@ else{ res = -1; } - if(telemetry_save) - ast_free(telemetry_save); + ast_free(telemetry_save); return res; } @@ -3907,8 +3906,7 @@ interval = 0; break; } - if(wait_times_save) - ast_free(wait_times_save); + ast_free(wait_times_save); return interval; } @@ -5193,8 +5191,7 @@ myrpt->active_telem = NULL; rpt_mutex_unlock(&myrpt->lock); ast_free(nodename); - if(id_malloc) - ast_free(ident); + ast_free(ident); ast_free(mytele); ast_hangup(mychannel); #ifdef APP_RPT_LOCK_DEBUG Index: main/astobj2.c =================================================================== --- main/astobj2.c (revision 186562) +++ main/astobj2.c (working copy) @@ -341,7 +341,10 @@ obj = internal_ao2_alloc(data_size, destructor_fn); if (obj == NULL) + { + fclose(refo); return NULL; + } if (refo) { fprintf(refo, "%p =1 %s:%d:%s (%s)\n", obj, file, line, funcname, tag); Index: main/cli.c =================================================================== --- main/cli.c (revision 186562) +++ main/cli.c (working copy) @@ -235,8 +235,7 @@ c += (strlen(ast_config_AST_MODULE_DIR) + 1); if (c) c = ast_strdup(c); - if (d) - free(d); + free(d); return c; }