Skip to contentSkip to conversation

LVM2 ./WHATS_NEW_DM libdm/libdm-file.c

PATCH [email protected] 1 participant 1 message Aug 4, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-08-04 17:56:12

Modified files:
. : WHATS_NEW_DM
libdm : libdm-file.c

Log message:
Add missing check for allocation failure

Static analyzer discovered missing check.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.485&r2=1.486
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-file.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16

WHATS_NEW_DM +1 -0
@@ -1,5 +1,6 @@
 Version 1.02.66 - 
 ===============================
+  Add missing check for allocation failure _create_dir_recursive().
   Add support for systemd file descriptor handover in dmeventd.
   Add support for new oom killer adjustment interface (oom_score_adj).
   Add systemd unit files for dmeventd.
libdm/libdm-file.c +5 -0
@@ -27,6 +27,11 @@
 	log_verbose("Creating directory \"%s\"", dir);
 	/* Create parent directories */
 	orig = s = dm_strdup(dir);
+	if (!s) {
+		log_error("Failed to duplicate directory name.");
+		return 0;
+	}
+
 	while ((s = strchr(s, '/')) != NULL) {
 		*s = '\0';
 		if (*orig) {