summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2013-07-04 17:49:11 +0200
committerGravatar Christian Hesse <mail@eworm.de>2013-07-04 17:49:11 +0200
commit744e276f874596b3496c2eacdc7b3e6896d16c11 (patch)
treed89b55d8e2aaa56de09a3c1af96c364f6bd8a90a
parent2f015dcd2204f080dbfed2c8f9ca3568bdcde41f (diff)
downloadudev-block-notify-744e276f874596b3496c2eacdc7b3e6896d16c11.tar.gz
udev-block-notify-744e276f874596b3496c2eacdc7b3e6896d16c11.tar.zst
fix condition for memory allocation
-rw-r--r--udev-block-notify.c4
1 files 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;