CID 703484: resource leak in error path
This commit is contained in:
		
							
								
								
									
										12
									
								
								funcs.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								funcs.c
									
									
									
									
									
								
							| @@ -38,7 +38,7 @@ | |||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.219 2012/05/09 23:20:56 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.220 2012/06/24 20:00:51 tg Exp $"); | ||||||
|  |  | ||||||
| #if HAVE_KILLPG | #if HAVE_KILLPG | ||||||
| /* | /* | ||||||
| @@ -3592,11 +3592,6 @@ c_cat(const char **wp) | |||||||
| 	char *buf, *cp; | 	char *buf, *cp; | ||||||
| #define MKSH_CAT_BUFSIZ 4096 | #define MKSH_CAT_BUFSIZ 4096 | ||||||
|  |  | ||||||
| 	if ((buf = malloc_osfunc(MKSH_CAT_BUFSIZ)) == NULL) { |  | ||||||
| 		bi_errorf(Toomem, (unsigned long)MKSH_CAT_BUFSIZ); |  | ||||||
| 		return (1); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* parse options: POSIX demands we support "-u" as no-op */ | 	/* parse options: POSIX demands we support "-u" as no-op */ | ||||||
| 	while ((rv = ksh_getopt(wp, &builtin_opt, "u")) != -1) { | 	while ((rv = ksh_getopt(wp, &builtin_opt, "u")) != -1) { | ||||||
| 		switch (rv) { | 		switch (rv) { | ||||||
| @@ -3611,6 +3606,11 @@ c_cat(const char **wp) | |||||||
| 	wp += builtin_opt.optind; | 	wp += builtin_opt.optind; | ||||||
| 	rv = 0; | 	rv = 0; | ||||||
|  |  | ||||||
|  | 	if ((buf = malloc_osfunc(MKSH_CAT_BUFSIZ)) == NULL) { | ||||||
|  | 		bi_errorf(Toomem, (unsigned long)MKSH_CAT_BUFSIZ); | ||||||
|  | 		return (1); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	do { | 	do { | ||||||
| 		if (*wp) { | 		if (*wp) { | ||||||
| 			fn = *wp++; | 			fn = *wp++; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user