From 58ef6ed22655adf4a797bedb85da862f872b10b8 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sun, 7 Jan 2001 17:03:55 +0000 Subject: 2000-12-21 Marcus Brinkmann * pager.c: Include . (create_disk_pager): Panic if malloc fails. Reported by Igor Khavkine . * inode.c (diskfs_get_translator): If malloc fails, set err to ENOMEM. Initialize err with 0, and return it at the end of the function. Reported by Igor Khavkine . --- ext2fs/inode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ext2fs/inode.c') diff --git a/ext2fs/inode.c b/ext2fs/inode.c index 248347e1..71b00705 100644 --- a/ext2fs/inode.c +++ b/ext2fs/inode.c @@ -707,7 +707,7 @@ diskfs_set_translator (struct node *np, const char *name, unsigned namelen, error_t diskfs_get_translator (struct node *np, char **namep, unsigned *namelen) { - error_t err; + error_t err = 0; daddr_t blkno; unsigned datalen; void *transloc; @@ -725,12 +725,14 @@ diskfs_get_translator (struct node *np, char **namep, unsigned *namelen) datalen = ((unsigned char *)transloc)[0] + (((unsigned char *)transloc)[1] << 8); *namep = malloc (datalen); + if (!*namep) + err = ENOMEM; bcopy (transloc + 2, *namep, datalen); diskfs_end_catch_exception (); *namelen = datalen; - return 0; + return err; } /* The maximum size of a symlink store in the inode (including '\0'). */ -- cgit v1.2.3