]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Hmf, avoid memory leak in error case.
authorAndreas Öman <andreas@lonelycoder.com>
Wed, 9 Sep 2009 20:47:48 +0000 (20:47 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Wed, 9 Sep 2009 20:47:48 +0000 (20:47 +0000)
src/htsp.c

index af0f5d2305b695df01c8991e686418f9baac96e7..ae70b5949722ead5e2ab7d021793422dbfb521b3 100644 (file)
@@ -459,12 +459,13 @@ htsp_method_getEvent(htsp_connection_t *htsp, htsmsg_t *in)
 static htsmsg_t *
 htsp_method_getDiskSpace(htsp_connection_t *htsp, htsmsg_t *in)
 {
-  htsmsg_t *out = htsmsg_create_map();
+  htsmsg_t *out;
   struct statvfs diskdata;
 
   if(statvfs(dvr_storage,&diskdata) == -1)
     return htsp_error("Unable to stat path");
   
+  out = htsmsg_create_map();
   htsmsg_add_s64(out, "freediskspace",
                 diskdata.f_bsize * (int64_t)diskdata.f_bavail);
   htsmsg_add_s64(out, "totaldiskspace",
@@ -486,6 +487,7 @@ htsp_method_getSysTime(htsp_connection_t *htsp, htsmsg_t *in)
   if(gettimeofday(&tv, &tz) == -1)
     return htsp_error("Unable to get system time"); 
 
+  out = htsmsg_create_map();
   htsmsg_add_s32(out, "time", tv.tv_sec);
   htsmsg_add_s32(out, "timezone", tz.tz_minuteswest);
   return out;