Revision e80cfcfc linux-user/elfload.c

b/linux-user/elfload.c
841 841
    unsigned int i;
842 842
    struct elf_shdr sechdr, symtab, strtab;
843 843
    char *strings;
844
    struct syminfo *s;
844 845

  
845 846
    lseek(fd, hdr->e_shoff, SEEK_SET);
846 847
    for (i = 0; i < hdr->e_shnum; i++) {
......
866 867

  
867 868
 found:
868 869
    /* Now know where the strtab and symtab are.  Snarf them. */
869
    disas_symtab = malloc(symtab.sh_size);
870
    disas_strtab = strings = malloc(strtab.sh_size);
871
    if (!disas_symtab || !disas_strtab)
870
    s = malloc(sizeof(*s));
871
    s->disas_symtab = malloc(symtab.sh_size);
872
    s->disas_strtab = strings = malloc(strtab.sh_size);
873
    if (!s->disas_symtab || !s->disas_strtab)
872 874
	return;
873 875
	
874 876
    lseek(fd, symtab.sh_offset, SEEK_SET);
875
    if (read(fd, disas_symtab, symtab.sh_size) != symtab.sh_size)
877
    if (read(fd, s->disas_symtab, symtab.sh_size) != symtab.sh_size)
876 878
	return;
877 879

  
878 880
#ifdef BSWAP_NEEDED
879 881
    for (i = 0; i < symtab.sh_size / sizeof(struct elf_sym); i++)
880
	bswap_sym(disas_symtab + sizeof(struct elf_sym)*i);
882
	bswap_sym(s->disas_symtab + sizeof(struct elf_sym)*i);
881 883
#endif
882 884

  
883 885
    lseek(fd, strtab.sh_offset, SEEK_SET);
884 886
    if (read(fd, strings, strtab.sh_size) != strtab.sh_size)
885 887
	return;
886
    disas_num_syms = symtab.sh_size / sizeof(struct elf_sym);
888
    s->disas_num_syms = symtab.sh_size / sizeof(struct elf_sym);
889
    s->next = syminfos;
890
    syminfos = s;
887 891
}
888 892

  
889 893
static int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,

Also available in: Unified diff