1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix loopfiles mem alloc.

This commit is contained in:
Alasdair Kergon 2005-05-09 17:02:52 +00:00
parent 4d12267641
commit c708ec79b1
3 changed files with 15 additions and 8 deletions

View File

@ -1,5 +1,6 @@
Version 2.01.11 -
==============================
Fix loopfiles alias alloc & mem debugging.
Un-inline dbg_strdup.
lv_reduce tidying.
Remove some unnecessary parameters.

View File

@ -50,6 +50,7 @@ static struct {
#define _alloc(x) pool_zalloc(_cache.mem, (x))
#define _free(x) pool_free(_cache.mem, (x))
#define _strdup(x) pool_strdup(_cache.mem, (x))
static int _insert(const char *path, int rec);
@ -69,7 +70,12 @@ struct device *dev_create_file(const char *filename, struct device *dev,
dbg_free(dev);
return NULL;
}
if (!(alias->str = dbg_strdup(filename))) {
log_error("filename strdup failed");
dbg_free(dev);
dbg_free(alias);
return NULL;
}
dev->flags = DEV_ALLOCED;
} else {
if (!(dev = _alloc(sizeof(*dev)))) {
@ -81,15 +87,13 @@ struct device *dev_create_file(const char *filename, struct device *dev,
_free(dev);
return NULL;
}
if (!(alias->str = _strdup(filename))) {
log_error("filename strdup failed");
return NULL;
}
}
}
if (!(alias->str = dbg_strdup(filename))) {
} else if (!(alias->str = dbg_strdup(filename))) {
log_error("filename strdup failed");
if (allocate && use_malloc) {
dbg_free(dev);
dbg_free(alias);
}
return NULL;
}

View File

@ -193,6 +193,8 @@ int dump_memory(void)
for (c = 0; c < sizeof(str) - 1; c++) {
if (c >= mb->length)
str[c] = ' ';
else if (*(char *)(mb->magic + c) == '\0')
str[c] = '\0';
else if (*(char *)(mb->magic + c) < ' ')
str[c] = '?';
else