/****************************************************************************
- * Copyright 2018-2020,2022 Thomas E. Dickey *
+ * Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
/*
* Author: Thomas E. Dickey
*
- * $Id: dots_xcurses.c,v 1.28 2022/12/04 00:40:11 tom Exp $
+ * $Id: dots_xcurses.c,v 1.29 2023/01/07 17:21:48 tom Exp $
*
* A simple demo of the wide-curses interface used for comparison with termcap.
*/
switch (ch) {
case 'T':
need = 6 + strlen(optarg);
- my_env = malloc(need);
- _nc_SPRINTF(my_env, _nc_SLIMIT(need) "TERM=%s", optarg);
- putenv(my_env);
+ if ((my_env = malloc(need)) != NULL) {
+ _nc_SPRINTF(my_env, _nc_SLIMIT(need) "TERM=%s", optarg);
+ putenv(my_env);
+ }
break;
#if HAVE_USE_DEFAULT_COLORS
case 'd':