On 2010-12-29 at 21:05:24 [+0100], revol@xxxxxxx wrote: > Author: mmu_man > Date: 2010-12-29 21:05:24 +0100 (Wed, 29 Dec 2010) > New Revision: 40037 > Changeset: http://dev.haiku-os.org/changeset/40037 > > Modified: > haiku/trunk/src/apps/debugger/files/SourceFile.cpp > Log: > Avoid leaking a file descriptor on error. Thanks PovAddict for running > cppcheck. > > > Modified: haiku/trunk/src/apps/debugger/files/SourceFile.cpp > =================================================================== > --- haiku/trunk/src/apps/debugger/files/SourceFile.cpp 2010-12-29 > 20:04:58 UTC (rev 40036) > +++ haiku/trunk/src/apps/debugger/files/SourceFile.cpp 2010-12-29 > 20:05:24 UTC (rev 40037) > @@ -63,12 +63,16 @@ > return errno; > } > > - if (st.st_size > kMaxSourceFileSize) > + if (st.st_size > kMaxSourceFileSize) { > + close (fd); > return B_FILE_TOO_LARGE; > + } > size_t fileSize = st.st_size; > > - if (fileSize == 0) > + if (fileSize == 0) { > + close (fd); > return B_BAD_VALUE; > + } Coding style, please. CU, Ingo