* Fix a couple potential frees of invalid pointers.
This commit is contained in:
parent
743a5ffdf9
commit
761f62ca26
6
log.c
6
log.c
@ -135,7 +135,11 @@ log_err(int level, enum _log_facility facility, char *fname, int lineno, char *f
|
|||||||
// user log
|
// user log
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
//vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
|
//vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
|
||||||
vasprintf(&errbuf, fmt, ap);
|
if (vasprintf(&errbuf, fmt, ap) == -1)
|
||||||
|
{
|
||||||
|
va_end(ap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
// timestamp
|
// timestamp
|
||||||
|
@ -565,7 +565,7 @@ Send501(struct upnphttp * h)
|
|||||||
static const char *
|
static const char *
|
||||||
findendheaders(const char * s, int len)
|
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')
|
if(s[0]=='\r' && s[1]=='\n' && s[2]=='\r' && s[3]=='\n')
|
||||||
return s;
|
return s;
|
||||||
@ -585,13 +585,9 @@ sendXMLdesc(struct upnphttp * h, char * (f)(int *))
|
|||||||
{
|
{
|
||||||
DPRINTF(E_ERROR, L_HTTP, "Failed to generate XML description\n");
|
DPRINTF(E_ERROR, L_HTTP, "Failed to generate XML description\n");
|
||||||
Send500(h);
|
Send500(h);
|
||||||
free(desc);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
BuildResp_upnphttp(h, desc, len);
|
||||||
{
|
|
||||||
BuildResp_upnphttp(h, desc, len);
|
|
||||||
}
|
|
||||||
SendResp_upnphttp(h);
|
SendResp_upnphttp(h);
|
||||||
CloseSocket_upnphttp(h);
|
CloseSocket_upnphttp(h);
|
||||||
free(desc);
|
free(desc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user