]> granicus.if.org Git - sudo/commitdiff
Fix a memory leak on the error path.
authorTodd C. Miller <Todd.Miller@sudo.ws>
Wed, 18 Apr 2018 16:09:22 +0000 (10:09 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Wed, 18 Apr 2018 16:09:22 +0000 (10:09 -0600)
src/load_plugins.c

index 620e72f45f360ae54deefe2de2ade98fff222dbf..5c2706b3ebcda7e99e7c046940f93c9fa1d49a3b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2016 Todd C. Miller <Todd.Miller@sudo.ws>
+ * Copyright (c) 2009-2018 Todd C. Miller <Todd.Miller@sudo.ws>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -312,6 +312,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
        info->path = strdup(SUDOERS_PLUGIN);
        if (info->symbol_name == NULL || info->path == NULL) {
            sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
+           free_plugin_info(info);
            goto done;
        }
        /* info->options = NULL; */
@@ -331,6 +332,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
            info->path = strdup(SUDOERS_PLUGIN);
            if (info->symbol_name == NULL || info->path == NULL) {
                sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
+               free_plugin_info(info);
                goto done;
            }
            /* info->options = NULL; */