aboutsummaryrefslogblamecommitdiffstats
path: root/libexec_destroy_command.c
blob: d5382fbd57d37abf1b2d6f11e2f59f613b2342f8 (plain) (tree)



































                                                           
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST


void
libexec_destroy_command(struct libexec_command *cmd)
{
	size_t i;

	if (!cmd)
		return;

	free(cmd->executable);

	for (i = 0; i < cmd->narguments; i++)
		free(cmd->arguments[i]);
	free(cmd->arguments);

	for (i = 0; i < cmd->nplumings; i++)
		libexec_destroy_pluming(&cmd->plumings[i]);
	free(cmd->plumings);

	if (cmd->environ) {
		for (i = 0; cmd->environ[i]; i++)
			free(cmd->environ[i]);
		free(cmd->environ);
	}

	*cmd = LIBEXEC_COMMAND_INIT;
}


#else
LIBEXEC_CONST__ int main(void) {return 0;} /* TODO test */
#endif