diff options
-rw-r--r-- | src/compiler/glsl/blob.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/glsl/blob.c b/src/compiler/glsl/blob.c index dd4341be961..14dc69092f0 100644 --- a/src/compiler/glsl/blob.c +++ b/src/compiler/glsl/blob.c @@ -70,10 +70,13 @@ align_blob(struct blob *blob, size_t alignment) { const size_t new_size = ALIGN(blob->size, alignment); - if (! grow_to_fit (blob, new_size - blob->size)) - return false; + if (blob->size < new_size) { + if (!grow_to_fit(blob, new_size - blob->size)) + return false; - blob->size = new_size; + memset(blob->data + blob->size, 0, new_size - blob->size); + blob->size = new_size; + } return true; } |