Imported from libpng-1.4.0beta24.tar
diff --git a/pngset.c b/pngset.c
index 493cfa5..22c0a6a 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * Last changed in libpng 1.4.0 [July 22, 2008]
+ * Last changed in libpng 1.4.0 [July 25, 2008]
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2008 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -167,7 +167,7 @@
       gamma=21474.83;
    }
    else
-      gamma=file_gamma;
+      gamma = file_gamma;
    info_ptr->gamma = (float)gamma;
 #ifdef PNG_FIXED_POINT_SUPPORTED
    info_ptr->int_gamma = (int)(gamma*100000.+.5);
@@ -200,7 +200,7 @@
        gamma = 0;
      }
      else
-       gamma=int_gamma;
+       gamma = int_gamma;
    }
 #ifdef PNG_FLOATING_POINT_SUPPORTED
    info_ptr->gamma = (float)(gamma/100000.);
@@ -502,6 +502,7 @@
    if (info_ptr->scal_s_height == NULL)
    {
       png_free (png_ptr, info_ptr->scal_s_width);
+      info_ptr->scal_s_width = NULL;
       png_warning(png_ptr,
        "Memory allocation failed while processing sCAL");
       return;
@@ -731,7 +732,7 @@
    int num_text)
 {
    int ret;
-   ret=png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
+   ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
    if (ret)
      png_error(png_ptr, "Insufficient memory to store text");
 }
@@ -855,13 +856,13 @@
 #ifdef PNG_iTXt_SUPPORTED
       if (text_ptr[i].compression > 0)
       {
-         textp->lang=textp->key + key_len + 1;
+         textp->lang = textp->key + key_len + 1;
          png_memcpy(textp->lang, text_ptr[i].lang, lang_len);
          *(textp->lang + lang_len) = '\0';
-         textp->lang_key=textp->lang + lang_len + 1;
+         textp->lang_key = textp->lang + lang_len + 1;
          png_memcpy(textp->lang_key, text_ptr[i].lang_key, lang_key_len);
          *(textp->lang_key + lang_key_len) = '\0';
-         textp->text=textp->lang_key + lang_key_len + 1;
+         textp->text = textp->lang_key + lang_key_len + 1;
       }
       else
 #endif
@@ -870,7 +871,7 @@
          textp->lang=NULL;
          textp->lang_key=NULL;
 #endif
-         textp->text=textp->key + key_len + 1;
+         textp->text = textp->key + key_len + 1;
       }
       if (text_length)
          png_memcpy(textp->text, text_ptr[i].text,
@@ -1066,7 +1067,6 @@
     png_memcpy(np, info_ptr->unknown_chunks,
            info_ptr->unknown_chunks_num * png_sizeof(png_unknown_chunk));
     png_free(png_ptr, info_ptr->unknown_chunks);
-    info_ptr->unknown_chunks=NULL;
 
     for (i = 0; i < num_unknowns; i++)
     {
@@ -1152,7 +1152,7 @@
     }
     if (chunk_list == NULL)
       return;
-    old_num_chunks=png_ptr->num_chunk_list;
+    old_num_chunks = png_ptr->num_chunk_list;
     new_list=(png_bytep)png_malloc(png_ptr,
        (png_size_t)
        (5*(num_chunks + old_num_chunks)));
@@ -1165,10 +1165,10 @@
     }
     png_memcpy(new_list + 5*old_num_chunks, chunk_list,
        (png_size_t)(5*num_chunks));
-    for (p=new_list + 5*old_num_chunks + 4, i = 0; i<num_chunks; i++, p += 5)
+    for (p = new_list + 5*old_num_chunks + 4, i = 0; i<num_chunks; i++, p += 5)
        *p=(png_byte)keep;
-    png_ptr->num_chunk_list=old_num_chunks + num_chunks;
-    png_ptr->chunk_list=new_list;
+    png_ptr->num_chunk_list = old_num_chunks + num_chunks;
+    png_ptr->chunk_list = new_list;
 #ifdef PNG_FREE_ME_SUPPORTED
     png_ptr->free_me |= PNG_FREE_LIST;
 #endif