Changeset: f2ee1ad88dbb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f2ee1ad88dbb
Modified Files:
common/utils/prompt.c
monetdb5/mal/mal_profiler.c
Branch: Jul2017
Log Message:
Close some potential file descriptor leaks.
diffs (35 lines):
diff --git a/common/utils/prompt.c b/common/utils/prompt.c
--- a/common/utils/prompt.c
+++ b/common/utils/prompt.c
@@ -154,11 +154,11 @@ simple_prompt(const char *prompt, int ma
fputs("\n", termout);
fflush(termout);
}
+#endif
if (termin != stdin)
fclose(termin);
if (termout != stdout)
fclose(termout);
-#endif
if (destination[0] == 0 && def)
strcpy(destination, def);
return destination;
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -978,11 +978,12 @@ static str getIOactivity(void){
if ( fd == NULL)
return buf;
(void) snprintf(buf+len, BUFSIZ-len-2,"thr %d ",i);
- if ((n = fread(buf+len, 1, BUFSIZ-len-2,fd)) == 0 )
- return buf;
+ n = fread(buf+len, 1, BUFSIZ-len-2,fd);
+ (void) fclose(fd);
+ if (n == 0)
+ return buf;
// extract the properties
mnstr_printf(GDKout,"#got io stat:%s\n",buf);
- (void)fclose (fd);
}
//MT_lock_unset(&GDKthreadLock);
buf[len++]='"';
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list