]> granicus.if.org Git - handbrake/commitdiff
LinGui: fix memory issues found by valgrind
authorjstebbins <jstebbins.hb@gmail.com>
Mon, 8 Sep 2008 00:24:11 +0000 (00:24 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Mon, 8 Sep 2008 00:24:11 +0000 (00:24 +0000)
one uninitialized variable
one missing free
one malloc that's 1 byte too small

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1676 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/callbacks.c
gtk/src/main.c
gtk/src/plist.c

index b185d4af45456dade1ee15b091ddd75ded6b3731..453fa693adbab967281051ab6c3888e33eb12254 100644 (file)
@@ -3864,6 +3864,7 @@ ghb_is_cd(GDrive *gd)
        device = g_drive_get_identifier(gd, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
        halDrive = libhal_drive_from_device_file (hal_ctx, device);
        dtype = libhal_drive_get_type(halDrive);
+       libhal_drive_free(halDrive);
        g_free(device);
        return (dtype == LIBHAL_DRIVE_TYPE_CDROM);
 }
index 6cf76ae1c44072f8afb6a4e4251570007d24d263..02012b9bd11f4f6e013b0aa0338e433bf8b8a364 100644 (file)
@@ -513,6 +513,7 @@ main (int argc, char *argv[])
        ud->queue = NULL;
        ud->current_job = NULL;
        ud->current_dvd_device = NULL;
+       ud->dont_clear_presets = FALSE;
        // Redirect stderr to the activity window
        IoRedirect(ud);
        // Enable events that alert us to media change events
index 93178b370d8cd4bada54d2ac02253c20d92389eb..b0a39c31b87996f8e00a14f3e7c4deb5247267df 100644 (file)
@@ -393,7 +393,7 @@ ghb_plist_parse_file(FILE *fd)
        fseek(fd, 0, SEEK_END);
        size = ftell(fd);
        fseek(fd, 0, SEEK_SET);
-       buffer = g_malloc(size);
+       buffer = g_malloc(size+1);
        size = fread(buffer, 1, size, fd);
        buffer[size] = 0;
        gval = ghb_plist_parse(buffer, (gssize)size);