From 744e276f874596b3496c2eacdc7b3e6896d16c11 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 4 Jul 2013 17:49:11 +0200 Subject: fix condition for memory allocation --- udev-block-notify.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev-block-notify.c b/udev-block-notify.c index fccd252..655843e 100644 --- a/udev-block-notify.c +++ b/udev-block-notify.c @@ -105,7 +105,7 @@ int main (int argc, char ** argv) { minor = minor(devnum); /* make sure we have allocated memory */ - if (maxmajor <= major) { + if (maxmajor < major) { notification = realloc(notification, (major + 1) * sizeof(size_t)); maxminor = realloc(maxminor, (major + 1) * sizeof(unsigned int)); while (maxmajor <= major) { @@ -115,7 +115,7 @@ int main (int argc, char ** argv) { } maxmajor--; } - if (maxminor[major] <= minor) { + if (maxminor[major] < minor) { notification[major] = realloc(notification[major], (minor + 1) * sizeof(size_t)); while (maxminor[major] <= minor) { notification[major][maxminor[major]] = NULL; -- cgit v1.2.3-70-g09d2