[lvm-devel] LVM2 daemons/dmeventd/dmeventd.c ./WHATS_NEW_DM

zkabelac at sourceware.org zkabelac at sourceware.org
Mon Feb 13 11:18:47 UTC 2012


CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac at sourceware.org	2012-02-13 11:18:46

Modified files:
	daemons/dmeventd: dmeventd.c 
	.              : WHATS_NEW_DM 

Log message:
	Check for allocation failure

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.88&r2=1.89
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.553&r2=1.554

--- LVM2/daemons/dmeventd/dmeventd.c	2012/02/10 13:46:23	1.88
+++ LVM2/daemons/dmeventd/dmeventd.c	2012/02/13 11:18:45	1.89
@@ -1782,9 +1782,16 @@
 		}
 	}
 
-	_initial_registrations = dm_malloc(sizeof(char*) * (count + 1));
+	if (!(_initial_registrations = dm_malloc(sizeof(char*) * (count + 1)))) {
+		fprintf(stderr, "Memory allocation registration failed.\n");
+		exit(EXIT_FAILURE);
+	}
+
 	for (i = 0; i < count; ++i) {
-		_initial_registrations[i] = dm_strdup(message);
+		if (!(_initial_registrations[i] = dm_strdup(message))) {
+			fprintf(stderr, "Memory allocation for message failed.\n");
+			exit(EXIT_FAILURE);
+		}
 		message += strlen(message) + 1;
 	}
 	_initial_registrations[count] = 0;
--- LVM2/WHATS_NEW_DM	2012/02/13 11:13:44	1.553
+++ LVM2/WHATS_NEW_DM	2012/02/13 11:18:46	1.554
@@ -1,5 +1,6 @@
 Version 1.02.71 - 
 ====================================
+  Check for allocation failure in dmeventd restart().
   Add few missing allocation failures tests in dmsetup.
   Fix potential risk of writing in front of buffer in _sysfs_get_dm_name().
 




More information about the lvm-devel mailing list