Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37708543
en ru br
ALT Linux repositórios
S:1.2.13-alt1
5.0: 1.2.3-alt5
4.1: 1.2.3-alt4
4.0: 1.2.3-alt4
3.0: 1.2.3-alt1

Group :: Sistema/Bibliotecas
RPM: zlib

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: zlib-1.2.3-alt-gzio-gzerror.patch
Download


diff -upk.orig zlib-1.2.3.orig/gzio.c zlib-1.2.3/gzio.c
--- zlib-1.2.3.orig/gzio.c	2005-07-02 15:37:21 +0000
+++ zlib-1.2.3/gzio.c	2005-07-02 15:48:46 +0000
@@ -41,7 +41,7 @@ extern void   free   OF((voidpf ptr));
 #endif
 
 #define ALLOC(size) malloc(size)
-#define TRYFREE(p) {if (p) free(p);}
+#define TRYFREE(p) {if (p) {free(p); (p) = NULL;}}
 
 static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
 
@@ -1006,11 +1006,15 @@ const char * ZEXPORT gzerror (file, errn
     if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
 
     TRYFREE(s->msg);
-    s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
+    s->msg = (char*)ALLOC((s->path ? strlen(s->path) + 2 : 0) + strlen(m) + 1);
     if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR);
-    strcpy(s->msg, s->path);
-    strcat(s->msg, ": ");
-    strcat(s->msg, m);
+    if (s->path) {
+        strcpy(s->msg, s->path);
+        strcat(s->msg, ": ");
+        strcat(s->msg, m);
+    } else {
+        strcpy(s->msg, m);
+    }
     return (const char*)s->msg;
 }
 
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009