Use rxvt_temp_buf in more places.
authorsf-exg <sf-exg>
Sat, 30 Jan 2010 20:26:04 +0000 (20:26 +0000)
committersf-exg <sf-exg>
Sat, 30 Jan 2010 20:26:04 +0000 (20:26 +0000)
src/rxvttoolkit.C
src/xdefaults.C

index 6f999f3..77c908f 100644 (file)
@@ -429,11 +429,11 @@ bool rxvt_display::ref_init ()
 #ifdef LOCAL_X_IS_UNIX
   if (id[0] == ':')
     {
 #ifdef LOCAL_X_IS_UNIX
   if (id[0] == ':')
     {
-      val = rxvt_malloc (5 + strlen (id) + 1);
+      if (!(val = rxvt_temp_buf<char> (5 + strlen (id) + 1)))
+        return false;
       strcpy (val, "unix/");
       strcat (val, id);
       dpy = XOpenDisplay (val);
       strcpy (val, "unix/");
       strcat (val, id);
       dpy = XOpenDisplay (val);
-      free (val);
     }
   else
 #endif
     }
   else
 #endif
@@ -636,7 +636,7 @@ rxvt_xim *rxvt_display::get_xim (const char *locale, const char *modifiers)
   l = strlen (locale);
   m = strlen (modifiers);
 
   l = strlen (locale);
   m = strlen (modifiers);
 
-  if (!(id = (char *)malloc (l + m + 2)))
+  if (!(id = rxvt_temp_buf<char> (l + m + 2)))
     return 0;
 
   memcpy (id, locale, l); id[l] = '\n';
     return 0;
 
   memcpy (id, locale, l); id[l] = '\n';
@@ -644,8 +644,6 @@ rxvt_xim *rxvt_display::get_xim (const char *locale, const char *modifiers)
 
   rxvt_xim *xim = xims.get (id);
 
 
   rxvt_xim *xim = xims.get (id);
 
-  free (id);
-
   return xim;
 }
 
   return xim;
 }
 
index 7188498..acecdaa 100644 (file)
@@ -556,10 +556,9 @@ rxvt_term::get_options (int argc, const char *const *argv)
         {
           if (i+1 < argc)
             {
         {
           if (i+1 < argc)
             {
-              char *res = (char *)malloc (strlen (opt) + strlen (argv[++i]) + 6);
+              char *res = rxvt_temp_buf<char> (strlen (opt) + strlen (argv[++i]) + 6);
               sprintf (res, "*.%s: %s\n", opt, argv[i]);
               XrmPutLineResource (&option_db, res);
               sprintf (res, "*.%s: %s\n", opt, argv[i]);
               XrmPutLineResource (&option_db, res);
-              free (res);
             }
         }
 #endif
             }
         }
 #endif