/****************************************************************************
- * Copyright 2019-2020,2022 Thomas E. Dickey *
+ * Copyright 2019-2022,2023 Thomas E. Dickey *
* Copyright 2007-2013,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
/*
* Author: Thomas E. Dickey - 2007
*
- * $Id: dots_mvcur.c,v 1.30 2022/12/10 23:22:09 tom Exp $
+ * $Id: dots_mvcur.c,v 1.31 2023/01/07 17:21:48 tom Exp $
*
* A simple demo of the terminfo interface, and mvcur.
*/
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_ENV
case 'e':