mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-09 01:18:39 +03:00
Return error for failing allocation
Fix case, where final strdup would have failed and it would miss to return failure for this case and return success and NULL pointer.
This commit is contained in:
parent
00067fb64a
commit
514976816d
@ -1,5 +1,6 @@
|
||||
Version 1.02.70 -
|
||||
===================================
|
||||
Return error for failing allocation in dm_asprintf().
|
||||
Add missing test for failing allocation in dm_realloc() code.
|
||||
Add test for memory allocation failures in regex matcher code.
|
||||
Simplify dm_task_set_geometry() and use dm_asprintf().
|
||||
|
@ -156,7 +156,9 @@ int dm_asprintf(char **result, const char *format, ...)
|
||||
}
|
||||
}
|
||||
|
||||
*result = dm_strdup(buf);
|
||||
if (!(*result = dm_strdup(buf)))
|
||||
n = -2; /* return -1 */
|
||||
|
||||
dm_free(buf);
|
||||
return n + 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user