smatch sometimes flags problems with ipmp_snap_take()
While building the fix for #11946, my build died with the following error:
/ws/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/smatch: ../common/ipmp_query.c:1109 ipmp_snap_take() error: double free of 'snap' /ws/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/smatch: ../common/ipmp_query.c:1112 ipmp_snap_take() error: dereferencing freed memory 'snap'
Initalizing snap and osnap to
NULL (despite it only mentioning 'snap', it required initializing both values to make the error disappear).
There are some known uninitialized bugs with smatch, and initializing the values to NULL is harmless, so that seems a reasonable workaround.
Updated by Electric Monk over 1 year ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit ad234cdc80febfeac2ea24977ab7cf9a7cc466ba Author: Jason King <email@example.com> Date: 2019-11-11T19:03:09.000Z 11951 smatch sometimes flags problems with ipmp_snap_take() Reviewed by: Andrew Stormont <firstname.lastname@example.org> Reviewed by: John Levon <email@example.com> Reviewed by: Toomas Soome <firstname.lastname@example.org> Reviewed by: Andy Fiddaman <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>