mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:52:56 +00:00
[CMD] Add missing memory allocation NULL checks (#161). CORE-8304
Adapted from a patch by Jacob S. Preciado. Bring also the code suggestions emitted during review.
This commit is contained in:
parent
73798d2e71
commit
3f892a8d6b
16 changed files with 293 additions and 147 deletions
|
@ -245,7 +245,7 @@ BOOL ReadCommand(LPTSTR str, INT maxlen)
|
|||
#ifdef FEATURE_HISTORY
|
||||
/* add to the history */
|
||||
if (str[0])
|
||||
History (0, str);
|
||||
History(0, str);
|
||||
#endif /*FEATURE_HISTORY*/
|
||||
str[charcount++] = _T('\n');
|
||||
str[charcount] = _T('\0');
|
||||
|
@ -479,7 +479,7 @@ BOOL ReadCommand(LPTSTR str, INT maxlen)
|
|||
#ifdef FEATURE_HISTORY
|
||||
/* add to the history */
|
||||
if (str[0])
|
||||
History (0, str);
|
||||
History(0, str);
|
||||
#endif
|
||||
str[charcount++] = _T('\n');
|
||||
str[charcount] = _T('\0');
|
||||
|
@ -503,7 +503,7 @@ BOOL ReadCommand(LPTSTR str, INT maxlen)
|
|||
#ifdef FEATURE_HISTORY
|
||||
/* get previous command from buffer */
|
||||
ClearCommandLine (str, maxlen, orgx, orgy);
|
||||
History (-1, str);
|
||||
History(-1, str);
|
||||
current = charcount = _tcslen (str);
|
||||
if (((charcount + orgx) / maxx) + orgy > maxy - 1)
|
||||
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
|
||||
|
@ -516,7 +516,7 @@ BOOL ReadCommand(LPTSTR str, INT maxlen)
|
|||
#ifdef FEATURE_HISTORY
|
||||
/* get next command from buffer */
|
||||
ClearCommandLine (str, maxlen, orgx, orgy);
|
||||
History (1, str);
|
||||
History(1, str);
|
||||
current = charcount = _tcslen (str);
|
||||
if (((charcount + orgx) / maxx) + orgy > maxy - 1)
|
||||
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue