Dolda2000 GitWeb
/
doldaconnect.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2bb70a7
)
Fixed fake OOM bug in transfergetdata.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Thu, 29 Nov 2007 20:14:46 +0000
(21:14 +0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Thu, 29 Nov 2007 20:14:46 +0000
(21:14 +0100)
daemon/transfer.c
patch
|
blob
|
blame
|
history
diff --git
a/daemon/transfer.c
b/daemon/transfer.c
index
bebe011
..
e2fe54e
100644
(file)
--- a/
daemon/transfer.c
+++ b/
daemon/transfer.c
@@
-292,8
+292,12
@@
void *transfergetdata(struct transfer *transfer, size_t *size)
return(NULL);
if((transfer->endpos >= 0) && (transfer->curpos + *size >= transfer->endpos))
{
- *size = transfer->endpos - transfer->curpos;
- buf = srealloc(buf, *size);
+ if((*size = transfer->endpos - transfer->curpos) == 0) {
+ free(buf);
+ buf = NULL;
+ } else {
+ buf = srealloc(buf, *size);
+ }
}
transfer->curpos += *size;
bytesupload += *size;