[vdr] VDR-1.3.46 Segmentation fault

Darren Salt linux at youmustbejoking.demon.co.uk
Mon Apr 10 03:50:35 CEST 2006


I demand that I definitely did write...

> I demand that Thomas Günther may or may not have written...
>> If I try to set the time transponder the vdr crashes. :-(
>> Program received signal SIGSEGV, Segmentation fault.

>> (gdb) bt
>> #0  0x401f4cff in strlen () from /lib/libc.so.6
>> #1  0x401f4a55 in strdup () from /lib/libc.so.6
>> #2  0x080e0b2f in cMenuEditItem::SetValue (this=0xa268768, Value=0x0) at menuitems.c:39

> I suggest replacing that line with
>   value = Value ? strdup(Value) : NULL;
[snip]

Full patch attached. On enabling the "set time from broadcast" function,
default to the first available channel.

-- 
| Darren Salt    | linux or ds at              | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
|   Let's keep the pound sterling

It is difficult to prophesy, especially about the future.
-------------- next part --------------
--- vdr-1.3.46~/menuitems.c
+++ vdr-1.3.46/menuitems.c
@@ -36,7 +36,7 @@
 void cMenuEditItem::SetValue(const char *Value)
 {
   free(value);
-  value = strdup(Value);
+  value = Value ? strdup(Value) : NULL;
   char *buffer = NULL;
   asprintf(&buffer, "%s:\t%s", name, value);
   SetText(buffer, false);
@@ -615,61 +615,18 @@
            }
         channel = (cChannel *)channel->Next();
         }
+  if (!number) {
+     // couldn't find the selected channel, or one hasn't yet been chosen;
+     // default to the first available channel
+     channel = Channels.First();
+     while (channel) {
+           if (!channel->GroupSep()) {
+              number = channel->Number();
+              break;
+              }
+           channel = (cChannel *)channel->Next();
+           }
+     }
   Set();
 }
 


More information about the vdr mailing list