Patch is clearly correct. The code path to exercise it is quite hard tough, need to format across a text block boundary, need to use auto fill, and justification. Only xedit uses it. Example on how to setup it is:
Ctrl+MiddleButton -> Auto Fill Ctrl+MiddleButton -> Break Columns... -> Left Column: 2, Right Column: 78 Ctrl+MiddleButton -> Justification -> Full Now on a paragraph, press Alt+Q. Note that lines starting with a non ascii character in the first column are treated as a paragraph boundary. You can work that by moving all text 1 column to the right, e.g. unselect Auto Fill, and press Ctrl+U,1,Ctrl+X+Tab, and select Auto Fill again. Acked-by: pcpa <[email protected]> 2012/5/26 Alan Coopersmith <[email protected]>: > XawStackAlloc() & XawStackFree() are macros to automate the process of > using a fixed size stack buffer for strings smaller than the buffer size, > and allocating/freeing memory for larger strings. > > XawStackFree is defined in src/Private.h as taking (pointer, stk_buffer) > and freeing pointer if it's not pointing to the stack buffer. > > Most of the calls of this macro get the ordering right, but a couple > got it reversed, passing a stack buffer to free() instead of the > allocated pointer. > > Found by the Parfait 0.5.0.1 bug checking tool: > > Error: Free memory not allocated dynamically by alloc (CWE 590) > Free() was called on a pointer 'buf' to the auto variable 'buf'. Free() > must only be used on dynamically allocated memory > at line 2281 of TextAction.c in function 'DoFormatText'. > 'buf' allocated at line 0 as auto variable. > at line 2296 of TextAction.c in function 'DoFormatText'. > 'buf' allocated at line 0 as auto variable. > > Signed-off-by: Alan Coopersmith <[email protected]> > --- > src/TextAction.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/TextAction.c b/src/TextAction.c > index 6705316..fe7e573 100644 > --- a/src/TextAction.c > +++ b/src/TextAction.c > @@ -2278,7 +2278,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool > force, int level, > text.length = bytes; > bytes -= text.length; > if (_XawTextReplace(ctx, tmp, tmp, &text)) { > - XawStackFree(buf, text.ptr); > + XawStackFree(text.ptr, buf); > return (XawEditError); > } > if (num_pos) { > @@ -2293,7 +2293,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool > force, int level, > } > position += count; > right += count; > - XawStackFree(buf, text.ptr); > + XawStackFree(text.ptr, buf); > } > break; > } > -- > 1.7.9.2 > _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
