NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-hppa/50684: [src/sys/arch/hppa/stand/mkboot/mkboot.c:359]: (error) Memory leak: elf_segments



>Number:         50684
>Category:       port-hppa
>Synopsis:       [src/sys/arch/hppa/stand/mkboot/mkboot.c:359]: (error) Memory leak: elf_segments
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-hppa-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 21 16:30:00 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20160121
>Organization:
>Environment:
>Description:

Source code is

    if (close(from) < 0)
        err(1, "%s", from_file);

    return total;
}

$ fgrep elf_segments src/sys/arch/hppa/stand/mkboot/mkboot.c
        Elf32_External_Phdr *elf_segments;
		elf_segments = malloc(memory_needed);
		if (elf_segments == NULL)
		n = read(from, elf_segments, memory_needed);
			if (ELFGET32(elf_segments[i].p_filesz) &&
			    ELFGET32(elf_segments[i].p_flags) & PF_X) {
			ELFGET32(elf_segments[elf_load_image_segment].p_offset) -
			ELFGET32(elf_segments[elf_load_image_segment].p_vaddr);
$ 

I see no matching call to free to the call to malloc.

>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index