From f52184d6bdd6af39a360ef2010c4351777fd6bc5 Mon Sep 17 00:00:00 2001 From: satbaby Date: Tue, 8 Dec 2009 17:18:45 +0000 Subject: [PATCH] initializ variable: buffer, Possible Resource leak:fd git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@33 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/nhttpd/yhttpd_core/yrequest.cpp | 2 +- src/nhttpd/yhttpd_core/ysocket.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nhttpd/yhttpd_core/yrequest.cpp b/src/nhttpd/yhttpd_core/yrequest.cpp index 71a067cd9..aae302ccf 100644 --- a/src/nhttpd/yhttpd_core/yrequest.cpp +++ b/src/nhttpd/yhttpd_core/yrequest.cpp @@ -492,7 +492,7 @@ unsigned int CWebserverRequest::HandlePostBoundary(std::string boundary, unsigne // open file for write int fd = open(upload_filename.c_str(), O_WRONLY|O_CREAT|O_TRUNC); - if (fd<=0) + if (fd<0) { aprintf("cannot open file %s: ", upload_filename.c_str()); dperror(""); diff --git a/src/nhttpd/yhttpd_core/ysocket.cpp b/src/nhttpd/yhttpd_core/ysocket.cpp index 3ff1aa675..0d8ef6d74 100644 --- a/src/nhttpd/yhttpd_core/ysocket.cpp +++ b/src/nhttpd/yhttpd_core/ysocket.cpp @@ -309,7 +309,7 @@ int CySocket::Send(char const *buffer, unsigned int length) //----------------------------------------------------------------------------- bool CySocket::CheckSocketOpen() { - char buffer[32]; + char buffer[32]={0}; #ifdef CONFIG_SYSTEM_CYGWIN return !(recv(sock, buffer, sizeof(buffer), MSG_PEEK | MSG_NOSIGNAL) == 0);