Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37879645
en ru br
Репозитории ALT
S:1.2.13-alt1
5.1: 1.2.3-alt5
4.1: 1.2.3-alt4
4.0: 1.2.3-alt4
3.0: 1.2.3-alt1
www.altlinux.org/Changes

Группа :: Система/Библиотеки
Пакет: zlib

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: zlib-1.2.3-alt-gzio-gzerror.patch
Скачать


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;
 }
 
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin