Module Name:    src
Committed By:   christos
Date:           Thu Jan 21 17:00:23 UTC 2016

Modified Files:
        src/sys/arch/hppa/stand/mkboot: mkboot.c

Log Message:
PR/50684: David Binderman: Fix memory leak


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/stand/mkboot/mkboot.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hppa/stand/mkboot/mkboot.c
diff -u src/sys/arch/hppa/stand/mkboot/mkboot.c:1.1 src/sys/arch/hppa/stand/mkboot/mkboot.c:1.2
--- src/sys/arch/hppa/stand/mkboot/mkboot.c:1.1	Mon Feb 24 02:23:43 2014
+++ src/sys/arch/hppa/stand/mkboot/mkboot.c	Thu Jan 21 12:00:23 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkboot.c,v 1.1 2014/02/24 07:23:43 skrll Exp $	*/
+/*	$NetBSD: mkboot.c,v 1.2 2016/01/21 17:00:23 christos Exp $	*/
 
 /*	$OpenBSD: mkboot.c,v 1.9 2001/05/17 00:57:55 pvalchev Exp $	*/
 
@@ -234,7 +234,7 @@ putfile(char *from_file, int to)
 	int from, check_sum = 0;
 	struct hppa_lifload load;
 	Elf32_External_Ehdr elf_header;
-	Elf32_External_Phdr *elf_segments;
+	Elf32_External_Phdr *elf_segments = NULL;
 	int i, header_count, memory_needed, elf_load_image_segment;
 
 	if ((from = open(from_file, O_RDONLY)) < 0)
@@ -356,6 +356,7 @@ putfile(char *from_file, int to)
 	if (close(from) < 0)
 		err(1, "%s", from_file);
 
+	free(elf_segments);
 	return total;
 }
 

Reply via email to