mirror of
https://github.com/reactos/reactos.git
synced 2026-06-02 09:20:43 +08: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:
@@ -64,7 +64,10 @@ PrintAlias (VOID)
|
||||
/* allocate memory for an extra \0 char to make parsing easier */
|
||||
ptr = cmd_alloc(len + sizeof(TCHAR));
|
||||
if (!ptr)
|
||||
{
|
||||
WARN("Cannot allocate memory for ptr!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Aliases = ptr;
|
||||
|
||||
@@ -107,6 +110,7 @@ VOID ExpandAlias (LPTSTR cmd, INT maxlen)
|
||||
buffer = cmd_alloc(maxlen);
|
||||
if (!buffer)
|
||||
{
|
||||
WARN("Cannot allocate memory for alias buffer!\n");
|
||||
cmd_free(tmp);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user