* regcache.c (new_register_cache): No need to check result of xcalloc.
* server.c (handle_search_memory): Back out calls to xmalloc, result is checked and error is returned to user upon failure. (handle_query): Ditto. Add more checks for result of malloc. (handle_v_cont): Check result of malloc, report error back to user upon failure. (handle_v_run): Ditto. Call freeargv. * server.h (freeargv): Declare. * utils.c (freeargv): New fn.
This commit is contained in:
parent
a90b386908
commit
aef93bd75f
5 changed files with 76 additions and 21 deletions
|
@ -87,6 +87,23 @@ xstrdup (const char *s)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Free a standard argv vector. */
|
||||
|
||||
void
|
||||
freeargv (char **vector)
|
||||
{
|
||||
char **scan;
|
||||
|
||||
if (vector != NULL)
|
||||
{
|
||||
for (scan = vector; *scan != NULL; scan++)
|
||||
{
|
||||
free (*scan);
|
||||
}
|
||||
free (vector);
|
||||
}
|
||||
}
|
||||
|
||||
/* Print the system error message for errno, and also mention STRING
|
||||
as the file name for which the error was encountered.
|
||||
Then return to command level. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue