lstab: Don't free lstab on update.

The modification timestamp of the leapfile is checked with every
call of lstab_utc2tai(). If the file is modified, the provided lstab
structure is freed and a new one is allocated from the updated leapfile.
But the new lstab is not returned to the caller as the function doesn't
accept a pointer to the pointer to lstab. This causes reading from the
freed memory and leak of the newly allocated memory.

Modify update_leapsecond_table() to read the updated leapfile into the
existing lstab structure instead of the reallocation.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
1 file changed
tree: 0b60eca6e7beb8fa1e6d5901de57649859d17ead
  1. configs/
  2. .gitignore
  3. address.h
  4. as_capable.h
  5. bmc.c
  6. bmc.h
  7. clock.c
  8. clock.h
  9. clockadj.c
  10. clockadj.h
  11. clockcheck.c
  12. clockcheck.h
  13. CODING_STYLE.org
  14. config.c
  15. config.h
  16. contain.h
  17. COPYING
  18. ddt.h
  19. designated_fsm.c
  20. designated_fsm.h
  21. dm.h
  22. ds.h
  23. e2e_tc.c
  24. ether.h
  25. fault.c
  26. fault.h
  27. fd.h
  28. filter.c
  29. filter.h
  30. filter_private.h
  31. foreign.h
  32. fsm.c
  33. fsm.h
  34. hash.c
  35. hash.h
  36. hwstamp_ctl.8
  37. hwstamp_ctl.c
  38. incdefs.sh
  39. interface.c
  40. interface.h
  41. linreg.c
  42. linreg.h
  43. lstab.c
  44. lstab.h
  45. makefile
  46. mave.c
  47. mave.h
  48. missing.h
  49. mmedian.c
  50. mmedian.h
  51. monitor.c
  52. monitor.h
  53. msg.c
  54. msg.h
  55. mtab.h
  56. nmea.c
  57. nmea.h
  58. notification.h
  59. nsm.8
  60. nsm.c
  61. ntpshm.c
  62. ntpshm.h
  63. nullf.c
  64. nullf.h
  65. p2p_tc.c
  66. pdt.h
  67. phc.c
  68. phc.h
  69. phc2sys.8
  70. phc2sys.c
  71. phc_ctl.8
  72. phc_ctl.c
  73. pi.c
  74. pi.h
  75. pmc.8
  76. pmc.c
  77. pmc_agent.c
  78. pmc_agent.h
  79. pmc_common.c
  80. pmc_common.h
  81. port.c
  82. port.h
  83. port_private.h
  84. port_signaling.c
  85. power_profile.h
  86. pqueue.c
  87. pqueue.h
  88. print.c
  89. print.h
  90. ptp4l.8
  91. ptp4l.c
  92. raw.c
  93. raw.h
  94. README.org
  95. refclock_sock.c
  96. refclock_sock.h
  97. rtnl.c
  98. rtnl.h
  99. serial.c
  100. serial.h
  101. servo.c
  102. servo.h
  103. servo_private.h
  104. sk.c
  105. sk.h
  106. sock.c
  107. sock.h
  108. stats.c
  109. stats.h
  110. sysoff.c
  111. sysoff.h
  112. tc.c
  113. tc.h
  114. telecom.c
  115. timemaster.8
  116. timemaster.c
  117. tlv.c
  118. tlv.h
  119. tmv.h
  120. transport.c
  121. transport.h
  122. transport_private.h
  123. ts2phc.8
  124. ts2phc.c
  125. ts2phc.h
  126. ts2phc_generic_pps_source.c
  127. ts2phc_generic_pps_source.h
  128. ts2phc_nmea_pps_source.c
  129. ts2phc_nmea_pps_source.h
  130. ts2phc_phc_pps_source.c
  131. ts2phc_phc_pps_source.h
  132. ts2phc_pps_sink.c
  133. ts2phc_pps_sink.h
  134. ts2phc_pps_source.c
  135. ts2phc_pps_source.h
  136. ts2phc_pps_source_private.h
  137. tsproc.c
  138. tsproc.h
  139. tz.h
  140. tz2alt.8
  141. tz2alt.c
  142. udp.c
  143. udp.h
  144. udp6.c
  145. udp6.h
  146. uds.c
  147. uds.h
  148. unicast_client.c
  149. unicast_client.h
  150. unicast_fsm.c
  151. unicast_fsm.h
  152. unicast_service.c
  153. unicast_service.h
  154. util.c
  155. util.h
  156. version.c
  157. version.h
  158. version.sh