(vfs_stamp_compare): fix NULL dereference.

(vfs_stamp): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2019-09-11 09:17:18 +03:00
parent 12a6af8f29
commit 8411b93ff7

View File

@ -127,7 +127,7 @@ vfs_stamp_compare (gconstpointer a, gconstpointer b)
const struct vfs_stamping *vsa = (const struct vfs_stamping *) a; const struct vfs_stamping *vsa = (const struct vfs_stamping *) a;
const struct vfs_stamping *vsb = (const struct vfs_stamping *) b; const struct vfs_stamping *vsb = (const struct vfs_stamping *) b;
return (vsa->v == vsb->v && vsa->id == vsb->id) ? 0 : 1; return (vsa == NULL || vsb == NULL || (vsa->v == vsb->v && vsa->id == vsb->id)) ? 0 : 1;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
@ -163,7 +163,7 @@ vfs_stamp (struct vfs_class *v, vfsid id)
gboolean ret = FALSE; gboolean ret = FALSE;
stamp = g_slist_find_custom (stamps, &what, vfs_stamp_compare); stamp = g_slist_find_custom (stamps, &what, vfs_stamp_compare);
if (stamp != NULL) if (stamp != NULL && stamp->data != NULL)
{ {
gettimeofday (&(VFS_STAMPING (stamp->data)->time), NULL); gettimeofday (&(VFS_STAMPING (stamp->data)->time), NULL);
ret = TRUE; ret = TRUE;