X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=ncurses%2Ftty%2Fhashmap.c;h=2ddfaaa29b64f90b3a84f79f0326160e4c0189cf;hb=515d83a2495606171a23c6eee948aea07536d178;hp=3f124c96c8968e11dad46c37ac8b7d4ea7a44e7f;hpb=91494ab0071e71177728916199a406768f5ef963;p=ncurses.git diff --git a/ncurses/tty/hashmap.c b/ncurses/tty/hashmap.c index 3f124c96..2ddfaaa2 100644 --- a/ncurses/tty/hashmap.c +++ b/ncurses/tty/hashmap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2019-2020,2023 Thomas E. Dickey * * Copyright 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -74,7 +74,7 @@ AUTHOR #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: hashmap.c,v 1.69 2020/05/31 17:50:48 tom Exp $") +MODULE_ID("$Id: hashmap.c,v 1.70 2023/06/25 17:16:01 tom Exp $") #ifdef HASHDEBUG @@ -318,8 +318,11 @@ NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_DCL0) if (newhash(SP_PARM) == 0) newhash(SP_PARM) = typeCalloc(unsigned long, (size_t) screen_lines(SP_PARM)); - if (!oldhash(SP_PARM) || !newhash(SP_PARM)) + if (!oldhash(SP_PARM) || !newhash(SP_PARM)) { + FreeAndNull(oldhash(SP_PARM)); + FreeAndNull(newhash(SP_PARM)); return; /* malloc failure */ + } for (i = 0; i < screen_lines(SP_PARM); i++) { newhash(SP_PARM)[i] = hash(SP_PARM, NEWTEXT(SP_PARM, i)); oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i));