Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 137059 | Differences between
and this patch

Collapse All | Expand All

(-)electricsheep/client/flam3/png.c (-4 / +13 lines)
Lines 14-19 Link Here
14
#include <stdio.h>
14
#include <stdio.h>
15
#include <stdlib.h>
15
#include <stdlib.h>
16
#include <png.h>
16
#include <png.h>
17
#include <setjmp.h>
17
18
18
#include "img.h"
19
#include "img.h"
19
20
Lines 67-73 Link Here
67
  unsigned char sig_buf [SIG_CHECK_SIZE];
68
  unsigned char sig_buf [SIG_CHECK_SIZE];
68
  png_struct *png_ptr;
69
  png_struct *png_ptr;
69
  png_info *info_ptr;
70
  png_info *info_ptr;
70
  png_byte **png_image;
71
  png_byte **png_image = NULL;
71
  int linesize, x, y;
72
  int linesize, x, y;
72
  unsigned char *p, *q;
73
  unsigned char *p, *q;
73
74
Lines 85-90 Link Here
85
    fprintf (stderr, "cannot allocate LIBPNG structure\n");
86
    fprintf (stderr, "cannot allocate LIBPNG structure\n");
86
    return 0;
87
    return 0;
87
  }
88
  }
89
  if (setjmp(png_jmpbuf(png_ptr))) {
90
     if (png_image) {
91
	 for (y = 0 ; y < info_ptr->height ; y++)
92
	     free (png_image[y]);
93
	 free (png_image);
94
     }
95
     png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
96
     perror("reading file");
97
     return;
98
  }
88
  info_ptr = png_create_info_struct (png_ptr);
99
  info_ptr = png_create_info_struct (png_ptr);
89
  if (info_ptr == NULL) {
100
  if (info_ptr == NULL) {
90
    png_destroy_read_struct (&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
101
    png_destroy_read_struct (&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
Lines 155-163 Link Here
155
  for (y = 0 ; y < info_ptr->height ; y++)
166
  for (y = 0 ; y < info_ptr->height ; y++)
156
    free (png_image[y]);
167
    free (png_image[y]);
157
  free (png_image);
168
  free (png_image);
158
  png_read_destroy (png_ptr, info_ptr, (png_info *)0);  
169
  png_destroy_read_struct (&png_ptr, &info_ptr, (png_infopp)NULL);  
159
  free (png_ptr);
160
  free (info_ptr);
161
170
162
  return q;
171
  return q;
163
}
172
}

Return to bug 137059