* mu: fix some leaks in commandline params

This commit is contained in:
djcb 2013-12-29 17:37:07 +02:00
parent 932b60397b
commit 391222b0ae
2 changed files with 21 additions and 13 deletions

View File

@ -181,9 +181,9 @@ set_group_find_defaults (void)
* date-from-subject, and sort descending by date. If fields
* *are* specified, we sort in ascending order. */
if (!MU_CONFIG.fields || !*MU_CONFIG.fields) {
MU_CONFIG.fields = "d f s";
MU_CONFIG.fields = g_strdup ("d f s");
if (!MU_CONFIG.sortfield)
MU_CONFIG.sortfield = "d";
MU_CONFIG.sortfield = g_strdup ("d");
}
if (!MU_CONFIG.formatstr) /* by default, use plain output */
@ -505,7 +505,7 @@ parse_cmd (int *argcp, char ***argvp, GError **err)
* etc.)*/
return TRUE;
MU_CONFIG.cmdstr = (*argvp)[1];
MU_CONFIG.cmdstr = g_strdup ((*argvp)[1]);
MU_CONFIG.cmd = cmd_from_string (MU_CONFIG.cmdstr);
#ifndef BUILD_GUILE
@ -748,10 +748,18 @@ mu_config_uninit (MuConfig *opts)
if (!opts)
return;
g_free (opts->cmdstr);
g_free (opts->muhome);
g_free (opts->maildir);
g_free (opts->fields);
g_free (opts->sortfield);
g_free (opts->bookmark);
g_free (opts->formatstr);
g_free (opts->exec);
g_free (opts->linksdir);
g_free (opts->targetdir);
g_free (opts->parts);
g_free (opts->script);
g_strfreev (opts->params);

View File

@ -91,20 +91,20 @@ typedef enum _MuConfigCmd MuConfigCmd;
struct _MuConfig {
MuConfigCmd cmd; /* the command, or
MuConfigCmd cmd; /* the command, or
* MU_CONFIG_CMD_NONE */
const char *cmdstr; /* cmd string, for user
char *cmdstr; /* cmd string, for user
* info */
/* general options */
gboolean quiet; /* don't give any output */
gboolean debug; /* spew out debug info */
gboolean quiet; /* don't give any output */
gboolean debug; /* spew out debug info */
gchar *muhome; /* the House of Mu */
gboolean version; /* request mu version */
gboolean log_stderr; /* log to stderr (not logfile) */
gchar** params; /* parameters (for querying) */
gboolean nocolor; /* don't use use ansi-colors
gboolean version; /* request mu version */
gboolean log_stderr; /* log to stderr (not logfile) */
gchar** params; /* parameters (for querying) */
gboolean nocolor; /* don't use use ansi-colors
* in some output */
gboolean verbose; /* verbose output */
gboolean verbose; /* verbose output */
/* options for indexing */
gchar *maildir; /* where the mails are */
@ -183,7 +183,7 @@ struct _MuConfig {
gboolean play; /* after saving, try to 'play'
* (open) the attmnt using xdgopen */
/* options for mu-script */
gchar *script; /* script to run */
gchar *script; /* script to run */
const char **script_params; /* parameters for scripts */
};
typedef struct _MuConfig MuConfig;