* Fix a couple potential frees of invalid pointers.

This commit is contained in:
Justin Maggard 2011-01-25 22:40:37 +00:00
parent 743a5ffdf9
commit 761f62ca26
2 changed files with 7 additions and 7 deletions

6
log.c
View File

@ -135,7 +135,11 @@ log_err(int level, enum _log_facility facility, char *fname, int lineno, char *f
// user log
va_start(ap, fmt);
//vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
vasprintf(&errbuf, fmt, ap);
if (vasprintf(&errbuf, fmt, ap) == -1)
{
va_end(ap);
return;
}
va_end(ap);
// timestamp

View File

@ -565,7 +565,7 @@ Send501(struct upnphttp * h)
static const char *
findendheaders(const char * s, int len)
{
while(len-->0)
while(len-- > 0)
{
if(s[0]=='\r' && s[1]=='\n' && s[2]=='\r' && s[3]=='\n')
return s;
@ -585,13 +585,9 @@ sendXMLdesc(struct upnphttp * h, char * (f)(int *))
{
DPRINTF(E_ERROR, L_HTTP, "Failed to generate XML description\n");
Send500(h);
free(desc);
return;
}
else
{
BuildResp_upnphttp(h, desc, len);
}
BuildResp_upnphttp(h, desc, len);
SendResp_upnphttp(h);
CloseSocket_upnphttp(h);
free(desc);