Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jul 2005 00:02:32 +0200 (CEST)
From:      Dan Lukes <dan@kulesh.obluda.cz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/83419: [ PATCH ] incorrect malloc failures handling within libstand
Message-ID:  <200507132202.j6DM2WW2025408@kulesh.obluda.cz>
Resent-Message-ID: <200507132210.j6DMAHje031231@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         83419
>Category:       bin
>Synopsis:       [ PATCH ] incorrect malloc failures handling within libstand
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 13 22:10:17 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Dan Lukes
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
Obludarium
>Environment:
System: FreeBSD 5.4-STABLE #8: Sat Jul 9 16:31:08 CEST 2005 i386
lib/libstand/environment.c,v 1.6 2003/10/26 04:04:12 peter

>Description:
	Incorrect malloc failures handling within libstand environment
handling
>How-To-Repeat:
>Fix:

--- patch begins here ---
--- lib/libstand/environment.c.ORIG	Fri Nov 14 03:26:04 2003
+++ lib/libstand/environment.c	Wed Jul 13 23:57:38 2005
@@ -82,7 +82,13 @@
 	 * New variable; create and sort into list
 	 */
 	ev = malloc(sizeof(struct env_var));
+	if (ev == NULL)
+		return(-1);
 	ev->ev_name = strdup(name);
+	if (ev->name == NULL) {
+		freee(ev);
+		return(-1);
+	}
 	ev->ev_value = NULL;
 	/* hooks can only be set when the variable is instantiated */
 	ev->ev_sethook = sethook;
--- patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507132202.j6DM2WW2025408>