NetBSD-Bugs archive

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

port-powerpc/50685: [src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c:841]: (error) Memory leak: header_img



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

Source code is


    close(bebox_fd);

    return 0;
}

No matching calls to malloc & free 

$ fgrep header_img src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c
	unsigned char *elf_img = NULL, *kern_img = NULL, *header_img = NULL;
	header_img = (unsigned char *)malloc(BEBOX_HEADER_SIZE);
	if (!header_img)
	memset(header_img, 0, BEBOX_HEADER_SIZE);
		memcpy(header_img + p->offset, p->data, p->size);
	memset(header_img + BEBOX_FILE_BLOCK_MAP_START, 0xff,
	*(int32_t *)(header_img + BEBOX_FILE_SIZE_OFFSET) =
	*(int32_t *)(header_img + BEBOX_FILE_SIZE_ALIGN_OFFSET) =
		*(int32_t *)(header_img + *offset) =
	write(bebox_fd, header_img, BEBOX_HEADER_SIZE);
	/* refill the header_img with zeros */
	memset(header_img, 0, BEBOX_BLOCK_SIZE * 2);
	write(bebox_fd, header_img, flength - endoff);
$ 

>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index