projects
/
framework
/
uifw
/
harfbuzz.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cd361ec
)
[buffer] Fail in _create() if we cannot pre-allocate the requested size
author
Behdad Esfahbod
<behdad@behdad.org>
Mon, 2 May 2011 23:35:05 +0000
(19:35 -0400)
committer
Behdad Esfahbod
<behdad@behdad.org>
Mon, 2 May 2011 23:35:05 +0000
(19:35 -0400)
src/hb-buffer.cc
patch
|
blob
|
history
diff --git
a/src/hb-buffer.cc
b/src/hb-buffer.cc
index
1e49c7a
..
4009b12
100644
(file)
--- a/
src/hb-buffer.cc
+++ b/
src/hb-buffer.cc
@@
-142,11
+142,13
@@
hb_buffer_create (unsigned int pre_alloc_size)
if (!(buffer = hb_object_create<hb_buffer_t> ()))
return &_hb_buffer_nil;
- if (pre_alloc_size)
- _hb_buffer_ensure (buffer, pre_alloc_size);
-
hb_buffer_reset (buffer);
+ if (pre_alloc_size && !_hb_buffer_ensure (buffer, pre_alloc_size)) {
+ hb_buffer_destroy (buffer);
+ return &_hb_buffer_nil;
+ }
+
return buffer;
}