X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib-crypt%2Fpgppacket.c;h=0956076526ccf4de7d398d5ccf18db4e9112584c;hb=4956024f0d540c5dd689444113307fa7f9dd4067;hp=39ebdf25b2539d95a52cbb93bdd8dadf6b998ea9;hpb=4761fa78a6dfc9437caa6e6e0aac806e50e01c83;p=apps%2Fmadmutt.git diff --git a/lib-crypt/pgppacket.c b/lib-crypt/pgppacket.c index 39ebdf2..0956076 100644 --- a/lib-crypt/pgppacket.c +++ b/lib-crypt/pgppacket.c @@ -7,17 +7,7 @@ * please see the file GPL in the top level source directory. */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include - -#include +#include #include #include "lib.h" @@ -32,17 +22,7 @@ static size_t plen = 0; static int read_material (size_t material, size_t * used, FILE * fp) { if (*used + material >= plen) { - unsigned char *p; - size_t nplen; - - nplen = *used + material + CHUNKSIZE; - - if (!(p = realloc (pbuf, nplen))) { /* __MEM_CHECKED__ */ - perror ("realloc"); - return -1; - } - plen = nplen; - pbuf = p; + p_realloc(&pbuf, plen = *used + material + CHUNKSIZE); } if (fread (pbuf + *used, 1, material, fp) < material) { @@ -65,7 +45,7 @@ unsigned char *pgp_read_packet (FILE * fp, size_t * len) startpos = ftello (fp); if (!plen) { - pbuf = p_new(char, plen = CHUNKSIZE); + pbuf = p_new(unsigned char, plen = CHUNKSIZE); } if (fread (&ctb, 1, 1, fp) < 1) {