cmnd = dst = reallocarray(NULL, cmnd_size, 2);
if (cmnd == NULL)
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
+ if (!gc_add(GC_PTR, cmnd))
+ exit(1);
+
for (av = argv; *av != NULL; av++) {
for (src = *av; *src != '\0'; src++) {
/* quote potential meta characters */
av = reallocarray(NULL, ac + 1, sizeof(char *));
if (av == NULL)
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
+ if (!gc_add(GC_PTR, av))
+ exit(1);
+
av[0] = (char *)user_details.shell; /* plugin may override shell */
if (cmnd != NULL) {
av[1] = "-c";
struct sudo_gc_entry {
SLIST_ENTRY(sudo_gc_entry) entries;
- enum sudo_gc_types {
- GC_UNKNOWN,
- GC_VECTOR,
- GC_PTR
- } type;
+ enum sudo_gc_types type;
union {
char **vec;
void *ptr;
static char **get_user_info(struct user_details *);
static void command_info_to_details(char * const info[],
struct command_details *details);
-static bool gc_add(enum sudo_gc_types type, void *ptr);
static void gc_init(void);
/* Policy plugin convenience functions. */
debug_return;
}
-static bool
+bool
gc_add(enum sudo_gc_types type, void *v)
{
#ifdef NO_LEAKS
int val;
};
-struct timeval;
+/* Garbage collector data types. */
+enum sudo_gc_types {
+ GC_UNKNOWN,
+ GC_VECTOR,
+ GC_PTR
+};
/* For fatal() and fatalx() (XXX - needed?) */
void cleanup(int);
int policy_init_session(struct command_details *details);
int run_command(struct command_details *details);
int os_init_common(int argc, char *argv[], char *envp[]);
+bool gc_add(enum sudo_gc_types type, void *v);
extern const char *list_user;
extern struct user_details user_details;
extern int sudo_debug_instance;