* 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:
Doug Evans 2009-01-19 00:16:46 +00:00
parent a90b386908
commit aef93bd75f
5 changed files with 76 additions and 21 deletions

View file

@ -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. */