public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mkfs.jffs2: convert to xalloc.h helpers
@ 2010-10-01 17:10 Mike Frysinger
  2010-10-02 14:14 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2010-10-01 17:10 UTC (permalink / raw)
  To: linux-mtd

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 mkfs.jffs2.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index 85a8564..256eec4 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -381,7 +381,7 @@ static struct filesystem_entry *recursive_add_host_directory(
 #define GETCWD_SIZE 0
 #else
 #define SCANF_PREFIX "511"
-#define SCANF_STRING(s) (s = malloc(512))
+#define SCANF_STRING(s) (s = xmalloc(512))
 #define GETCWD_SIZE -1
 inline int snprintf(char *str, size_t n, const char *fmt, ...)
 {
@@ -1540,14 +1540,7 @@ void process_buffer(int inp_size) {
 void parse_image(){
 	int ret;
 
-	file_buffer = malloc(erase_block_size);
-
-	if (!file_buffer) {
-		perror("out of memory");
-		close (in_fd);
-		close (out_fd);
-		exit(1);
-	}
+	file_buffer = xmalloc(erase_block_size);
 
 	while ((ret = load_next_block())) {
 		process_buffer(ret);
@@ -1721,7 +1714,7 @@ int main(int argc, char **argv)
 					  jffs2_compression_check_set(1);
 					  break;
 			case 'y':
-					  compr_name = malloc(strlen(optarg));
+					  compr_name = xmalloc(strlen(optarg));
 					  sscanf(optarg,"%d:%s",&compr_prior,compr_name);
 					  if ((compr_prior>=0)&&(compr_name)) {
 						  if (jffs2_set_compressor_priority(compr_name, compr_prior))
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mkfs.jffs2: convert to xalloc.h helpers
  2010-10-01 17:10 [PATCH] mkfs.jffs2: convert to xalloc.h helpers Mike Frysinger
@ 2010-10-02 14:14 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2010-10-02 14:14 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd

On Fri, 2010-10-01 at 13:10 -0400, Mike Frysinger wrote:
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  mkfs.jffs2.c |   13 +++----------
>  1 files changed, 3 insertions(+), 10 deletions(-)

Pushed to mtd-utils.git, thanks!

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-02 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-01 17:10 [PATCH] mkfs.jffs2: convert to xalloc.h helpers Mike Frysinger
2010-10-02 14:14 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox