changeset 27835:28b6709b52a2

Avoid a potential memleak in parse_obj_params in case of a missing m_ob_params_t part. Fixes bug #1318.
author reimar
date Fri, 31 Oct 2008 12:59:17 +0000
parents d35bcab9833b
children bf7f14c6dfaa
files m_option.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/m_option.c	Fri Oct 31 12:56:25 2008 +0000
+++ b/m_option.c	Fri Oct 31 12:59:17 2008 +0000
@@ -1476,13 +1476,14 @@
   int r;
   m_obj_params_t* p = opt->priv;
   const m_struct_t* desc;
-  char* cpy = strdup(param);
+  char* cpy;
   
   // We need the object desc
   if(!p)
     return M_OPT_INVALID;
   
   desc = p->desc;
+  cpy = strdup(param);
   r = get_obj_params(name,desc->name,cpy,desc,p->separator,dst ? &opts : NULL);
   free(cpy);
   if(r < 0)