[gitg] fix segfault in load_refs



commit f7c47ef35e009b274f2cb50701c777406307772f
Author: Vitaliy Ischenko <betalb gmail com>
Date:   Fri Jul 24 14:47:07 2009 +0400

    fix segfault in load_refs
    
    check for return value of gitg_repository_command_with_outputv
    not to be NULL

 gitg/gitg-repository.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gitg/gitg-repository.c b/gitg/gitg-repository.c
index 6295871..ea6e8b7 100644
--- a/gitg/gitg-repository.c
+++ b/gitg/gitg-repository.c
@@ -1093,11 +1093,16 @@ load_current_ref(GitgRepository *self)
 static void
 load_refs(GitgRepository *self)
 {
-	gchar *current = load_current_ref(self);
-	
 	gchar **refs = gitg_repository_command_with_outputv(self, NULL, "for-each-ref", "--format=%(refname) %(objectname) %(*objectname)", "refs", NULL);
+	
+	if (!refs)
+	{
+		return;
+	}
+		
 	gchar **buffer = refs;
 	gchar *buf;
+	gchar *current = load_current_ref(self);
 	
 	while ((buf = *buffer++) != NULL)
 	{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]