File tree Expand file tree Collapse file tree 2 files changed +23
-14
lines changed Expand file tree Collapse file tree 2 files changed +23
-14
lines changed Original file line number Diff line number Diff line change @@ -564,22 +564,26 @@ void upsdrv_initups(void)
564
564
565
565
void upsdrv_cleanup (void )
566
566
{
567
- if ( (mode == MODE_META ) || (mode == MODE_REPEATER ) )
568
- {
569
- if (ups )
570
- {
571
- upscli_disconnect (ups );
572
- }
573
-
574
- if (ctx )
575
- {
576
- pconf_finish (ctx );
577
- free (ctx );
578
- }
567
+ if (ups ) {
568
+ upscli_disconnect (ups );
569
+ free (ups );
570
+ ups = NULL ;
571
+ }
579
572
573
+ if (client_upsname ) {
580
574
free (client_upsname );
575
+ client_upsname = NULL ;
576
+ }
577
+
578
+ if (hostname ) {
581
579
free (hostname );
582
- free (ups );
580
+ hostname = NULL ;
581
+ }
582
+
583
+ if (ctx ) {
584
+ pconf_finish (ctx );
585
+ free (ctx );
586
+ ctx = NULL ;
583
587
}
584
588
}
585
589
Original file line number Diff line number Diff line change @@ -1792,11 +1792,16 @@ static void splitxarg(char *inbuf)
1792
1792
}
1793
1793
1794
1794
/* see if main handles this first */
1795
- if (main_arg (buf , val ))
1795
+ if (main_arg (buf , val )) {
1796
+ free (buf );
1797
+
1796
1798
return ;
1799
+ }
1797
1800
1798
1801
/* otherwise store it for later */
1799
1802
storeval (buf , val );
1803
+
1804
+ free (buf );
1800
1805
}
1801
1806
1802
1807
/* dump the list from the vartable for external parsers */
You can’t perform that action at this time.
0 commit comments