> On 29/08/2025 02:45, yubiao hu wrote: >> * src/df.c (get_dev): Fix potential null pointer dereference >> - Avoid dereferencing stat_file when both device and >> mount_point are NULL >> - Handle allocation failure for cell when mount_point >> is NULL > > These are valid concerns. > I also see potential null dereferences of device. > The attached patch takes a different approach > by ensuring arguments are initialized earlier. > > Marking this as done. > > Will push the attached later.
Thank you for the code optimization. I would like to highlight a potential issue: if both mount_point and device are NULL, stat_file still end up being NULL. This could lead to a core dump at the `error(0, errno, "%s", quotef(stat_file));` However, there may never be a situation where both mount_point and device are null at the same time.