Memory issues with OpenGL/Qt

Hi everyone,
Not really sure where this thread belongs, but here it is. When running Qt applications that use opengl, Valgrind reports things such as

Invalid write of size 4
  in GLWidget::paintGL() in /home/techwinder/dev/Qt/opengl/hellogl2/glwidget.cpp:257
Address 0x7f69bd320c94 is not stack'd, malloc'd or (recently) free'd  1: /usr/lib64/dri/i965_dri.so
  2: /usr/lib64/dri/i965_dri.so
  3: QOpenGLFunctions::glClear(unsigned int) in /usr/include/qt5/QtGui/qopenglfunctions.h:596
  4: GLWidget::paintGL() in /home/techwinder/dev/Qt/opengl/hellogl2/glwidget.cpp:257
  5: /usr/lib64/libQt5Widgets.so.5.6.2
  6: QWidget::event(QEvent*) in /usr/lib64/libQt5Widgets.so.5.6.2
  7: QApplicationPrivate::notify_helper(QObject*, QEvent*) in /usr/lib64/libQt5Widgets.so.5.6.2
  8: QApplication::notify(QObject*, QEvent*) in /usr/lib64/libQt5Widgets.so.5.6.2
  9: QCoreApplication::notifyInternal2(QObject*, QEvent*) in /usr/lib64/libQt5Core.so.5.6.2
  10: QWidgetPrivate::sendPaintEvent(QRegion const&) in /usr/lib64/libQt5Widgets.so.5.6.2
  11: QOpenGLWidget::resizeEvent(QResizeEvent*) in /usr/lib64/libQt5Widgets.so.5.6.2
  12: QWidget::event(QEvent*) in /usr/lib64/libQt5Widgets.so.5.6.2
  13: QApplicationPrivate::notify_helper(QObject*, QEvent*) in /usr/lib64/libQt5Widgets.so.5.6.2
  14: QApplication::notify(QObject*, QEvent*) in /usr/lib64/libQt5Widgets.so.5.6.2
  15: QCoreApplication::notifyInternal2(QObject*, QEvent*) in /usr/lib64/libQt5Core.so.5.6.2
  16: QWidgetPrivate::sendPendingMoveAndResizeEvents(bool, bool) in /usr/lib64/libQt5Widgets.so.5.6.2
  17: QWidgetPrivate::show_helper() in /usr/lib64/libQt5Widgets.so.5.6.2
  18: QWidget::setVisible(bool) in /usr/lib64/libQt5Widgets.so.5.6.2
  19: QWidgetPrivate::showChildren(bool) in /usr/lib64/libQt5Widgets.so.5.6.2
  20: QWidgetPrivate::show_helper() in /usr/lib64/libQt5Widgets.so.5.6.2
  21: QWidget::setVisible(bool) in /usr/lib64/libQt5Widgets.so.5.6.2
  22: QWidgetPrivate::showChildren(bool) in /usr/lib64/libQt5Widgets.so.5.6.2
  23: QWidgetPrivate::show_helper() in /usr/lib64/libQt5Widgets.so.5.6.2
  24: QWidget::setVisible(bool) in /usr/lib64/libQt5Widgets.so.5.6.2
  25: QWidgetPrivate::showChildren(bool) in /usr/lib64/libQt5Widgets.so.5.6.2

For instance, this can be checked with the hellogl2 example compiled with the qt5.6.2 libs that come with LEAP 42.3
http://doc.qt.io/qt-5/qtopengl-hellogl2-example.html

My linux science isn’t good enough to tell if the problem is with my environment, with valgrind, with Qt or with the OS, and what should be done about it. Apart from these messages, the apps run fine.
Any insight will be much appreciated.

Thanks.