maint: avoid useless "if (foo) free(foo)" pattern

My Coccinelle semantic patch finds a few more, because it also fixes up
the equally pointless conditional

    if (foo) {
        free(foo);
        foo = NULL;
    }

Result (feel free to squash it into your patch):

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Markus Armbruster authored and Michael Tokarev committed 2015-09-11 10:21:38 +03:00
1 parent ef1e1e0782
commit 012aef0734
9 files changed
+20 -40

No files matched your search

+2 -4
View File
@@ -731,10 +731,8 @@ void tb_free(TranslationBlock *tb)
static inline void invalidate_page_bitmap(PageDesc *p)
{
if (p->code_bitmap) {
g_free(p->code_bitmap);
p->code_bitmap = NULL;
}
g_free(p->code_bitmap);
p->code_bitmap = NULL;
p->code_write_count = 0;
}