From: Fredrik Tolf Date: Thu, 29 Nov 2007 20:14:46 +0000 (+0100) Subject: Fixed fake OOM bug in transfergetdata. X-Git-Tag: 1.1~31^2~2 X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=e3f10dc2796fd709fece28a8a2e82733bc273d47;p=doldaconnect.git Fixed fake OOM bug in transfergetdata. --- diff --git a/daemon/transfer.c b/daemon/transfer.c index bebe011..e2fe54e 100644 --- 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;