On 12/22/2016 3:22 AM, David Faure wrote:
> There seems to be a regression in valgrind SVN, where it thinks new[] was 
> used, while in fact a simple new was used.
> I see this all over the place when running valgrind on Qt code.
>
> ==4799== Mismatched free() / delete / delete []
> ==4799==    at 0x4C2A65D: operator delete(void*) (vg_replace_malloc.c:576)
> ==4799==    by 0x6CF853D: QVBoxLayout::~QVBoxLayout() (qboxlayout.cpp:1354)
> ==4799==    by 0x6D1CE90: QWidget::~QWidget() (qwidget.cpp:1594)
> ==4799==    by 0x6F631A1: QDialog::~QDialog() (qdialog.cpp:352)
> ==4799==    by 0x5152C85: 
> Akonadi::EmailAddressSelectionDialog::~EmailAddressSelectionDialog() 
> (emailaddressselectiondialog.cpp:92)
> ==4799==    by 0x401876: main (emailaddressselectiondialogtest.cpp:35)
> ==4799==  Address 0x279546e0 is 0 bytes inside a block of size 32 alloc'd
> ==4799==    at 0x4C29D78: operator new[](unsigned long) 
> (vg_replace_malloc.c:423)
> ==4799==    by 0x5152DB7: 
> Akonadi::EmailAddressSelectionDialog::Private::Private(Akonadi::EmailAddressSelectionDialog*,
>  QAbstractItemModel*) (emailaddressselectiondialog.cpp:40)
> ==4799==    by 0x5152B22: 
> Akonadi::EmailAddressSelectionDialog::EmailAddressSelectionDialog(QWidget*) 
> (emailaddressselectiondialog.cpp:82)
> ==4799==    by 0x401681: main (emailaddressselectiondialogtest.cpp:35)
>
> emailaddressselectiondialog.cpp:40 says
>   QVBoxLayout *mainLayout = new QVBoxLayout(q);
>
> And this is just one example, it happens in many many places, it's nothing 
> special about this particular file.
>
> Any idea why this is happening?
>
> gcc (SUSE Linux) 4.8.5
> valgrind-3.13.0.SVN
> glibc-2.22-3.7.x86_64
> `uname -a` = Linux 4.4.36-8-default #1 SMP Fri Dec 9 16:18:38 UTC 2016 
> (3ec5648) x86_64 x86_64 x86_64 GNU/Linux
> OpenSuSE Leap 42.2
>
If this is new valgrind behavior, I wouldn't discount a bug in its code, 
but the developers (not me) would need to know what the QVBoxLayout 
constructor is doing.  If it's inlined, the call stack might point 
fingers at the calling function rather than the true offender.  Does the 
QVBoxLayout constructor allocate any memory inside?

-- 
     David Chapman      dcchap...@acm.org
     Chapman Consulting -- San Jose, CA
     Software Development Done Right.
     www.chapman-consulting-sj.com


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to