Просмотр исходного кода

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 17 лет назад
Родитель
Сommit
a5f7997f23
1 измененных файлов с 4 добавлено и 1 удалено
  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)