]> git.street.me.uk Git - andy/viking.git/blobdiff - src/dem.c
Fix internal tile locking
[andy/viking.git] / src / dem.c
index 66085671700ec0ab0ae7ee6ed03b2df73c51a259..9c86a0529b6d476c503ab40498523fa5e2a41a7b 100644 (file)
--- a/src/dem.c
+++ b/src/dem.c
  *
  */
 
  *
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdio.h>
 #include <stdio.h>
+#ifdef HAVE_STRING_H
 #include <string.h>
 #include <string.h>
+#endif
 #include <glib.h>
 #include <glib.h>
+#ifdef HAVE_MATH_H
 #include <math.h>
 #include <math.h>
+#endif
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #include <stdlib.h>
+#endif
 #include <zlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <zlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -431,8 +441,10 @@ VikDEM *vik_dem_new_from_file(const gchar *file)
 
       /* Header */
   f = g_fopen(file, "r");
 
       /* Header */
   f = g_fopen(file, "r");
-  if ( !f )
+  if ( !f ) {
+    g_free ( rv );
     return NULL;
     return NULL;
+  }
   buffer[fread(buffer, 1, DEM_BLOCK_SIZE, f)] = '\0';
   if ( ! dem_parse_header ( buffer, rv ) ) {
     g_free ( rv );
   buffer[fread(buffer, 1, DEM_BLOCK_SIZE, f)] = '\0';
   if ( ! dem_parse_header ( buffer, rv ) ) {
     g_free ( rv );