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/
  2: /usr/lib64/dri/
  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/
  6: QWidget::event(QEvent*) in /usr/lib64/
  7: QApplicationPrivate::notify_helper(QObject*, QEvent*) in /usr/lib64/
  8: QApplication::notify(QObject*, QEvent*) in /usr/lib64/
  9: QCoreApplication::notifyInternal2(QObject*, QEvent*) in /usr/lib64/
  10: QWidgetPrivate::sendPaintEvent(QRegion const&) in /usr/lib64/
  11: QOpenGLWidget::resizeEvent(QResizeEvent*) in /usr/lib64/
  12: QWidget::event(QEvent*) in /usr/lib64/
  13: QApplicationPrivate::notify_helper(QObject*, QEvent*) in /usr/lib64/
  14: QApplication::notify(QObject*, QEvent*) in /usr/lib64/
  15: QCoreApplication::notifyInternal2(QObject*, QEvent*) in /usr/lib64/
  16: QWidgetPrivate::sendPendingMoveAndResizeEvents(bool, bool) in /usr/lib64/
  17: QWidgetPrivate::show_helper() in /usr/lib64/
  18: QWidget::setVisible(bool) in /usr/lib64/
  19: QWidgetPrivate::showChildren(bool) in /usr/lib64/
  20: QWidgetPrivate::show_helper() in /usr/lib64/
  21: QWidget::setVisible(bool) in /usr/lib64/
  22: QWidgetPrivate::showChildren(bool) in /usr/lib64/
  23: QWidgetPrivate::show_helper() in /usr/lib64/
  24: QWidget::setVisible(bool) in /usr/lib64/
  25: QWidgetPrivate::showChildren(bool) in /usr/lib64/

For instance, this can be checked with the hellogl2 example compiled with the qt5.6.2 libs that come with LEAP 42.3

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.