1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Check for allocation failure

This commit is contained in:
Zdenek Kabelac 2012-02-13 11:18:45 +00:00
parent dab4bb3bdf
commit a140caa666
2 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.71 -
====================================
Check for allocation failure in dmeventd restart().
Add few missing allocation failures tests in dmsetup.
Fix potential risk of writing in front of buffer in _sysfs_get_dm_name().

View File

@ -1782,9 +1782,16 @@ static void restart(void)
}
}
_initial_registrations = dm_malloc(sizeof(char*) * (count + 1));
if (!(_initial_registrations = dm_malloc(sizeof(char*) * (count + 1)))) {
fprintf(stderr, "Memory allocation registration failed.\n");
exit(EXIT_FAILURE);
}
for (i = 0; i < count; ++i) {
_initial_registrations[i] = dm_strdup(message);
if (!(_initial_registrations[i] = dm_strdup(message))) {
fprintf(stderr, "Memory allocation for message failed.\n");
exit(EXIT_FAILURE);
}
message += strlen(message) + 1;
}
_initial_registrations[count] = 0;