Pysam wants several functions not included in the library
[samtools.git] / debian / patches / razip-oom-check
1 --- a/razip.c   2011-10-20 11:05:21.020305754 -0700
2 +++ b/razip.c   2011-10-20 11:48:26.208271871 -0700
3 @@ -79,7 +79,13 @@
4                         if(pstdout){
5                                 f_dst = fileno(stdout);
6                         } else {
7 -                               char *name = malloc(sizeof(strlen(argv[optind]) + 5));
8 +                               char *name = (char *)malloc(sizeof(char) * (strlen(argv[optind]) + 5));
9 +                               if (name == NULL)
10 +                               {
11 +                                       fprintf(stderr, " -- Out of memory --\n");
12 +                                       return 1;
13 +                               }
14 +
15                                 strcpy(name, argv[optind]);
16                                 strcat(name, ".rz");
17                                 f_dst = write_open(name, is_forced);
18