Avoid a potential memleak

Change-Id: I76f30fb40743a989bce25b40238cf0db55bd07e0
This commit is contained in:
Urvang Joshi 2013-09-16 13:12:33 -07:00
parent 3ebe175781
commit e89c6fc867

View File

@ -77,7 +77,10 @@ WebPFrameCache* WebPFrameCacheNew(size_t kmin, size_t kmax) {
cache->size = kmax - kmin;
cache->encoded_frames =
(EncodedFrame*)calloc(cache->size, sizeof(*cache->encoded_frames));
if (cache->encoded_frames == NULL) return 0;
if (cache->encoded_frames == NULL) {
free(cache);
return NULL;
}
return cache;
}