Mercurial > mplayer.hg
comparison sub/spudec.c @ 35209:b7ec2526b402
Set pointers to NULL after free.
For the pal_image one it would have been possible
to leak the old pointer of the malloc for "image" failed.
author | reimar |
---|---|
date | Tue, 30 Oct 2012 18:53:58 +0000 |
parents | 135b1ef31668 |
children | 9fb45b9710cc |
comparison
equal
deleted
inserted
replaced
35208:9e06c2e4844e | 35209:b7ec2526b402 |
---|---|
225 this->stride = stride; | 225 this->stride = stride; |
226 this->height = height; | 226 this->height = height; |
227 if (this->image_size < this->stride * this->height) { | 227 if (this->image_size < this->stride * this->height) { |
228 if (this->image != NULL) { | 228 if (this->image != NULL) { |
229 free(this->image); | 229 free(this->image); |
230 this->image = NULL; | |
230 free(this->pal_image); | 231 free(this->pal_image); |
232 this->pal_image = NULL; | |
231 this->image_size = 0; | 233 this->image_size = 0; |
232 this->pal_width = this->pal_height = 0; | 234 this->pal_width = this->pal_height = 0; |
233 } | 235 } |
234 this->image = malloc(2 * this->stride * this->height); | 236 this->image = malloc(2 * this->stride * this->height); |
235 if (this->image) { | 237 if (this->image) { |