mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-22 21:38:24 +00:00
Fixed a bug
1) Fixed a bug When something error occured in multipart uploading process, s3fs forgets to free memory. (from r451) Fixed this bug. git-svn-id: http://s3fs.googlecode.com/svn/trunk@454 df820570-a93a-0410-bd06-b72b767a4274
This commit is contained in:
parent
b1e1312cfb
commit
0c630ba2d0
@ -1964,22 +1964,29 @@ int S3fsCurl::MultipartUploadRequest(const char* tpath, headers_t& meta, int fd,
|
|||||||
if(-1 == (fd2 = dup(fd)) || 0 != lseek(fd2, 0, SEEK_SET) || NULL == (file = fdopen(fd2, "rb"))){
|
if(-1 == (fd2 = dup(fd)) || 0 != lseek(fd2, 0, SEEK_SET) || NULL == (file = fdopen(fd2, "rb"))){
|
||||||
FGPRINT("S3fsCurl::MultipartUploadRequest : Cloud not duplicate file discriptor(errno=%d)\n", errno);
|
FGPRINT("S3fsCurl::MultipartUploadRequest : Cloud not duplicate file discriptor(errno=%d)\n", errno);
|
||||||
SYSLOGERR("Cloud not duplicate file discriptor(errno=%d)", errno);
|
SYSLOGERR("Cloud not duplicate file discriptor(errno=%d)", errno);
|
||||||
|
if(-1 != fd2){
|
||||||
|
close(fd2);
|
||||||
|
}
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
if(-1 == fstat(fd2, &st)){
|
if(-1 == fstat(fd2, &st)){
|
||||||
FGPRINT("S3fsCurl::MultipartUploadRequest: Invalid file discriptor(errno=%d)\n", errno);
|
FGPRINT("S3fsCurl::MultipartUploadRequest: Invalid file discriptor(errno=%d)\n", errno);
|
||||||
SYSLOGERR("Invalid file discriptor(errno=%d)", errno);
|
SYSLOGERR("Invalid file discriptor(errno=%d)", errno);
|
||||||
|
fclose(file);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make Tempolary buf(maximum size + 4)
|
// make Tempolary buf(maximum size + 4)
|
||||||
if(NULL == (buf = (unsigned char*)malloc(sizeof(unsigned char) * (MULTIPART_SIZE + 4)))){
|
if(NULL == (buf = (unsigned char*)malloc(sizeof(unsigned char) * (MULTIPART_SIZE + 4)))){
|
||||||
SYSLOGCRIT("Could not allocate memory for buffer\n");
|
SYSLOGCRIT("Could not allocate memory for buffer\n");
|
||||||
|
fclose(file);
|
||||||
S3FS_FUSE_EXIT();
|
S3FS_FUSE_EXIT();
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(0 != (result = PreMultipartPostRequest(tpath, meta, upload_id, ow_sse_flg))){
|
if(0 != (result = PreMultipartPostRequest(tpath, meta, upload_id, ow_sse_flg))){
|
||||||
|
free(buf);
|
||||||
|
fclose(file);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
DestroyCurlHandle();
|
DestroyCurlHandle();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user