Explorar el Código

set_set: Don't try list_delete or free on a NULL old

Bryan Drewery hace 8 años
padre
commit
4334aaa5b4
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/userent.cc

+ 1 - 1
src/userent.cc

@@ -273,7 +273,7 @@ static bool set_set(struct userrec *u, struct user_entry *e, void *buf)
   }
 
   /* if we have a new entry and an old entry.. or our new entry is empty -> clear out the old entry */
-  if ((old && old != newxk) || !newxk->data || !newxk->data[0]) {
+  if (old && old != newxk && (!newxk->data || !newxk->data[0])) {
     list_delete((struct list_type **) (&e->u.extra), (struct list_type *) old);
 
     free(old->key);