NetBSD-Bugs archive

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

bin/50291: usbhidaction(1) leaks memory on re-reading the config file



>Number:         50291
>Category:       bin
>Synopsis:       usbhidaction(1) leaks memory on re-reading the config file
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 29 13:15:00 +0000 2015
>Originator:     ITOH Yasufumi
>Release:        NetBSD 5.1_RC4
>Organization:
>Environment:
System: NetBSD mei.my.domain 5.1_RC4 NetBSD 5.1_RC4 (MEI) #20: Thu Dec 5 21:05:24 JST 2013 itohy%mei.my@localhost.domain:/usr/src/sys/arch/i386/compile/MEI i386
Architecture: i386
Machine: i386
>Description:
	usbhidaction(1) leaks strdup()ed memory in the command structure
	when re-reading the config file.

>How-To-Repeat:
	Found by a brain.

>Fix:
	Here's an untested patch to rev 1.25.

diff -up usbhidaction.c.orig usbhidaction.c
--- usbhidaction.c.orig	2015-09-27 22:25:24.000000000 +0900
+++ usbhidaction.c	2015-09-27 22:27:16.000000000 +0900
@@ -450,6 +450,8 @@ freecommands(struct command *cmd)
 	struct command *next;
 
 	while (cmd) {
+		free(cmd->name);
+		free(cmd->action);
 		next = cmd->next;
 		free(cmd);
 		cmd = next;



Home | Main Index | Thread Index | Old Index