Commit 8ce3c44c authored by Markus Armbruster's avatar Markus Armbruster Committed by Michael S. Tsirkin
Browse files

loader: g_realloc(p, 0) frees and returns NULL, simplify



Once upon a time, it was decided that qemu_realloc(ptr, 0) should
abort.  Switching to glib retired that bright idea.  A bit of code
that was added to cope with it (commit 3e372cf8) is still around.  Bury
it.

See also commit 6528499f.

Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent ed911435
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -147,7 +147,6 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab,
        }
        i++;
    }
    if (nsyms) {
    syms = g_realloc(syms, nsyms * sizeof(*syms));

    qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ));
@@ -156,10 +155,6 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab,
            syms[i].st_size = syms[i + 1].st_value - syms[i].st_value;
        }
    }
    } else {
        g_free(syms);
        syms = NULL;
    }

    /* String table */
    if (symtab->sh_link >= ehdr->e_shnum)