Fix SEGV for quit command in cmdfile
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 8 Oct 2009 20:57:43 +0000 (22:57 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 8 Oct 2009 21:00:25 +0000 (23:00 +0200)
If cmdfile is passed to yaz-client (option -f) and that cmdfile
included a 'quit' command that would result in a memory violation.

client/client.c

index cea207c..2692a9c 100644 (file)
@@ -3899,9 +3899,10 @@ static void initialize(const char *rc_file)
 
     cmd_format("usmarc");
 
+    file_history = file_history_new();
+
     source_rc_file(rc_file);
 
-    file_history = file_history_new();
     file_history_load(file_history);
     file_history_trav(file_history, 0, add_to_readline_history);
 }