Index: trunk/lib/regfi.c
===================================================================
--- trunk/lib/regfi.c	(revision 180)
+++ trunk/lib/regfi.c	(revision 181)
@@ -1289,5 +1289,5 @@
 	}
       }
-      talloc_reference(nk, nk->values);
+      talloc_steal(nk, nk->values);
     }
   }
@@ -1319,5 +1319,5 @@
 	nk->num_subkeys = 0;
       }
-      talloc_reference(nk, nk->subkeys);
+      talloc_steal(nk, nk->subkeys);
     }
   }
@@ -1442,5 +1442,5 @@
 
   /* In this case, we want file_cb to be freed when ret_val is */
-  talloc_reference(ret_val, file_cb);
+  talloc_steal(ret_val, file_cb);
   return ret_val;
 
@@ -1495,5 +1495,5 @@
   if(rb->hbins == NULL)
     goto fail;
-  talloc_reference(rb, rb->hbins);
+  talloc_steal(rb, rb->hbins);
 
   rla = true;
@@ -1504,5 +1504,5 @@
     rla = range_list_add(rb->hbins, hbin->file_off, hbin->block_size, hbin);
     if(rla)
-      talloc_reference(rb->hbins, hbin);
+      talloc_steal(rb->hbins, hbin);
 
     hbin_off = hbin->file_off + hbin->block_size;
@@ -1655,4 +1655,6 @@
     return NULL;
   }
+  ret_val->cur_key = root;
+  talloc_steal(ret_val, root);
 
   ret_val->key_positions = void_stack_new(REGFI_MAX_DEPTH);
@@ -1662,8 +1664,7 @@
     return NULL;
   }
-  talloc_reference(ret_val, ret_val->key_positions);
+  talloc_steal(ret_val, ret_val->key_positions);
 
   ret_val->f = file;
-  ret_val->cur_key = root;
   ret_val->cur_subkey = 0;
   ret_val->cur_value = 0;
@@ -1710,5 +1711,5 @@
     return false;
   }
-  talloc_reference(i, subkey);
+  talloc_steal(i, subkey);
 
   i->cur_key = subkey;
@@ -1995,5 +1996,5 @@
   ret_val->raw = raw;
   ret_val->size = parse_length;
-  talloc_reference(ret_val, raw);
+  talloc_steal(ret_val, raw);
 
   interpreted = talloc_array(NULL, char, parse_length);
@@ -2015,5 +2016,5 @@
     interpreted = talloc_realloc(NULL, interpreted, char, conv_size);
     ret_val->interpreted = interpreted;
-    talloc_reference(ret_val, interpreted);
+    talloc_steal(ret_val, interpreted);
   }
 
@@ -2095,5 +2096,5 @@
     return NULL;
   
-  talloc_reference(ret_val, raw_data.buf);
+  talloc_steal(ret_val, raw_data.buf);
   ret_val->raw = raw_data.buf;
   ret_val->size = raw_data.len;
@@ -2150,5 +2151,5 @@
     data->interpreted.string = tmp_str;
     data->interpreted_size = tmp_size;
-    talloc_reference(data, tmp_str);
+    talloc_steal(data, tmp_str);
     break;
 
@@ -2235,6 +2236,6 @@
     /* XXX: how meaningful is this?  should we store number of strings instead? */
     data->interpreted_size = tmp_size;
-    talloc_reference(tmp_array, tmp_str);
-    talloc_reference(data, tmp_array);
+    talloc_steal(tmp_array, tmp_str);
+    talloc_steal(data, tmp_array);
     break;
 
@@ -2419,5 +2420,5 @@
 REGFI_HBIN* regfi_parse_hbin(REGFI_FILE* file, uint32_t offset, bool strict)
 {
-  REGFI_HBIN *hbin;
+  REGFI_HBIN* hbin = NULL;
   uint8_t hbin_header[REGFI_HBIN_HEADER_SIZE];
   uint32_t length;
Index: trunk/src/reglookup-recover.c
===================================================================
--- trunk/src/reglookup-recover.c	(revision 180)
+++ trunk/src/reglookup-recover.c	(revision 181)
@@ -35,5 +35,5 @@
 bool print_leftover = false;
 bool print_parsedraw = false;
-char* registry_file = NULL;
+const char* registry_file = NULL;
 
 #include "common.c"
@@ -818,8 +818,5 @@
     }
   }
-  /*test_offset = strtol(argv[argi++], NULL, 16);*/
-
-  if((registry_file = strdup(argv[argi])) == NULL)
-    bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Memory allocation problem.\n");
+  registry_file = argv[argi];
 
   fd = openHive(registry_file);
Index: trunk/src/reglookup.c
===================================================================
--- trunk/src/reglookup.c	(revision 180)
+++ trunk/src/reglookup.c	(revision 181)
@@ -40,5 +40,5 @@
 char* path_filter = NULL;
 int type_filter;
-char* registry_file = NULL;
+const char* registry_file = NULL;
 
 /* Other globals */
@@ -617,6 +617,5 @@
     }
   }
-  if((registry_file = strdup(argv[argi])) == NULL)
-    bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Memory allocation problem.\n");
+  registry_file = argv[argi];
 
   fd = openHive(registry_file);
