]> diplodocus.org Git - nmh/blobdiff - sbr/context_del.c
Fix invalid pointer arithmetic.
[nmh] / sbr / context_del.c
index efe5e41051ebea4573b2fe0da0a2de7633594d10..592af0cad34e0d0e17593283274fc2007eb7ba16 100644 (file)
@@ -18,8 +18,9 @@ context_del (char *key)
 {
     struct node *np, *pp;
 
+    key = FENDNULL(key);
     for (np = m_defs, pp = NULL; np; pp = np, np = np->n_next) {
-       if (!strcasecmp (FENDNULL(np->n_name), FENDNULL(key))) {
+       if (!strcasecmp(FENDNULL(np->n_name), key)) {
            if (!np->n_context)
                inform("bug: context_del(key=\"%s\"), continuing...", np->n_name);
            if (pp)
@@ -27,7 +28,7 @@ context_del (char *key)
            else
                m_defs = np->n_next;
            free (np->n_name);
-            mh_xfree(np->n_field);
+            free(np->n_field);
            free(np);
            ctxflags |= CTXMOD;
            return 0;