fix some warnings from static analysis

http://code.google.com/p/webp/issues/detail?id=138

Change-Id: I21470e965357cc14eab356e2c477c7846ff76ef2
This commit is contained in:
skal
2013-09-12 09:32:28 +02:00
parent 80b54e1c69
commit d51f45f047
10 changed files with 51 additions and 25 deletions

View File

@ -43,7 +43,10 @@ static int BitWriterResize(VP8BitWriter* const bw, size_t extra_size) {
bw->error_ = 1;
return 0;
}
memcpy(new_buf, bw->buf_, bw->pos_);
if (bw->pos_ > 0) {
assert(bw->buf_ != NULL);
memcpy(new_buf, bw->buf_, bw->pos_);
}
free(bw->buf_);
bw->buf_ = new_buf;
bw->max_pos_ = new_size;