Re: rotor plugin puzzling question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

ACK: this was clearly a bug ;-)

martinez@xxxxxxx a écrit :
Is it just me or the newly released rotor plugin for vdr 1.7.9 needs the
following patch to the plugin itself in order to run (although it compiles
fine without it)
If the author reads these lines I would love to know why...

--- rotor.c.old	2006-06-14 23:44:27.000000000 +0200
+++ rotor.c	2006-06-14 23:46:43.000000000 +0200
@@ -96,7 +96,8 @@
       continue;
     if ((diseqc=Diseqcs.Get(source->Code(),12000,'h')) ||
(diseqc=Diseqcs.Get(source->Code(),12000,'v')) ||
(diseqc=Diseqcs.Get(source->Code(),12000,'l')) ||
(diseqc=Diseqcs.Get(source->Code(),12000,'r'))) {
-      char *c=strdup(diseqc->Commands());
+      char *commandstring=strdup(diseqc->Commands());
+ char *c=commandstring; while (c = strchr(c, '['))
       {
         char *e = strchr(++c, ']');
@@ -131,7 +132,7 @@
           break;
         }
       }
-      free(c);
+      free(commandstring);

I am not the author (nor even a user) but you are absolutely right.
You must free the pointer as returned by strdup; not one that you have modified or incremented :(
So you need to keep a virgin copy of the pointer as you have done.

Cheers,
Chris



_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux