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

[or-cvs] Fix possible free(NULL) in control.c



Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv20424/src/or

Modified Files:
	control.c 
Log Message:
Fix possible free(NULL) in control.c

Index: control.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- control.c	24 Oct 2005 19:39:45 -0000	1.144
+++ control.c	25 Oct 2005 07:02:13 -0000	1.145
@@ -847,10 +847,14 @@
   }
 
  done:
-  if (answers) SMARTLIST_FOREACH(answers, char *, cp, tor_free(cp));
-  if (questions) SMARTLIST_FOREACH(questions, char *, cp, tor_free(cp));
-  smartlist_free(answers);
-  smartlist_free(questions);
+  if (answers) {
+    SMARTLIST_FOREACH(answers, char *, cp, tor_free(cp));
+    smartlist_free(answers);
+  }
+  if (questions) {
+    SMARTLIST_FOREACH(questions, char *, cp, tor_free(cp));
+    smartlist_free(questions);
+  }
   smartlist_free(unrecognized);
   tor_free(msg);
 
@@ -1472,10 +1476,14 @@
   }
 
  done:
-  if (answers) SMARTLIST_FOREACH(answers, char *, cp, tor_free(cp));
-  if (questions) SMARTLIST_FOREACH(questions, char *, cp, tor_free(cp));
-  smartlist_free(answers);
-  smartlist_free(questions);
+  if (answers) {
+    SMARTLIST_FOREACH(answers, char *, cp, tor_free(cp));
+    smartlist_free(answers);
+  }
+  if (questions) {
+    SMARTLIST_FOREACH(questions, char *, cp, tor_free(cp));
+    smartlist_free(questions);
+  }
   smartlist_free(unrecognized);
   tor_free(msg);
 
@@ -2483,7 +2491,7 @@
 
 /** We got a log message: tell any interested control connections. */
 void
-control_event_logmsg(int severity, int domain, const char *msg)
+control_event_logmsg(int severity, unsigned int domain, const char *msg)
 {
   int oldlog, event;