fixed valgrind-warnings:

- added missing initialization of buffile->buf
- corrected malloc-call
This commit is contained in:
boercher
2005-08-19 23:13:05 +00:00
parent fb6bd00a53
commit 8c3f36f890
+2 -1
View File
@@ -27,6 +27,7 @@ buffile *buffile_open( const char *path, const char *mode ) {
file->pos=0;
file->bytesread=0;
file->buf=NULL;
file->f = fopen( path, mode );
if( NULL == file->f ) {
@@ -76,7 +77,7 @@ char * buffile_read ( buffile * file, size_t n ) {
}
file->pos = 0;
}
strncpy(returnbuf, file->buf + (file->pos++), sizeof(returnbuf));
strncpy(returnbuf, file->buf + (file->pos++), n);
return returnbuf;
}