Ver Fonte

exce/main.c: handle strdup failure

* exec/main.c (main): Upon strdup failure, log the error and exit.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2107 fd59a12c-fef9-0310-b244-a6a79926bd2f
Jim Meyering há 17 anos atrás
pai
commit
a5f7997f23
1 ficheiros alterados com 4 adições e 1 exclusões
  1. 4 1
      exec/main.c

+ 4 - 1
exec/main.c

@@ -790,7 +790,10 @@ int main (int argc, char **argv)
 	}
 
 	/* Make a copy so we can deface it with strtok */
-	config_iface = strdup(config_iface_init);
+	if ((config_iface = strdup(config_iface_init)) == NULL) {
+		log_printf (LOGSYS_LEVEL_ERROR, "exhausted virtual memory");
+		corosync_exit_error (AIS_DONE_OBJDB);
+	}
 
 	iface = strtok(config_iface, ":");
 	while (iface)