Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:Update
cdio-utils
libcdio-0.94-leak-12.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libcdio-0.94-leak-12.patch of Package cdio-utils
From 3cb2a4458b81b1e866ec4466582727b8550d0c86 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" <rocky@gnu.org> Date: Sat, 2 Dec 2017 08:11:25 -0500 Subject: [PATCH 12/20] Remove memory leak in cdio_eject_media_drive --- example/C++/eject.cpp | 16 ++++++++-------- example/eject.c | 16 +++++++--------- lib/driver/device.c | 5 ++++- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/example/C++/eject.cpp b/example/C++/eject.cpp index e4835279..7cced180 100644 --- a/example/C++/eject.cpp +++ b/example/C++/eject.cpp @@ -1,6 +1,6 @@ /* - Copyright (C) 2005, 2006, 2008, 209 Rocky Bernstein <rocky@gnu.org> - + Copyright (C) 2005, 2006, 2008, 2009 Rocky Bernstein <rocky@gnu.org> + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -17,7 +17,7 @@ /* Simple program to eject a CD-ROM drive door and then close it again. - If a single argument is given, it is used as the CD-ROM device to + If a single argument is given, it is used as the CD-ROM device to eject/close. Otherwise a CD-ROM drive will be scanned for. */ #ifdef HAVE_CONFIG_H @@ -43,8 +43,8 @@ main(int argc, const char *argv[]) driver_return_code_t ret; driver_id_t driver_id = DRIVER_DEVICE; char *psz_drive = NULL; - - if (argc > 1) + + if (argc > 1) psz_drive = strdup(argv[1]); if (!psz_drive) { @@ -66,14 +66,14 @@ main(int argc, const char *argv[]) printf("Eject of CD-ROM drive %s failed.\n", psz_drive); break; } - + if (DRIVER_OP_SUCCESS == cdio_close_tray(psz_drive, &driver_id)) { printf("Closed tray of CD-ROM drive %s.\n", psz_drive); } else { printf("Closing tray of CD-ROM drive %s failed.\n", psz_drive); } free(psz_drive); - + ret = cdio_eject_media_drive(NULL); switch(ret) { case DRIVER_OP_UNSUPPORTED: @@ -89,7 +89,7 @@ main(int argc, const char *argv[]) driver_id = DRIVER_DEVICE; if (DRIVER_OP_SUCCESS == cdio_close_tray(NULL, &driver_id)) { - printf("Closed tray of CD-ROM drive for default disc driver:\n\t%s\n", + printf("Closed tray of CD-ROM drive for default disc driver:\n\t%s\n", cdio_driver_describe(driver_id)); } else { printf("Closing tray of CD-ROM drive failed for default " diff --git a/example/eject.c b/example/eject.c index b278b019..5092d388 100644 --- a/example/eject.c +++ b/example/eject.c @@ -1,8 +1,6 @@ /* - $Id: eject.c,v 1.5 2008/03/24 15:30:55 karl Exp $ - Copyright (C) 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org> - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -19,10 +17,10 @@ /* Simple program to eject a CD-ROM drive door and then close it again. - If a single argument is given, it is used as the CD-ROM device to + If a single argument is given, it is used as the CD-ROM device to eject/close. Otherwise a CD-ROM drive will be scanned for. - See also corresponding C++ program of a similar name. + See also corresponding C++ program of a similar name. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -47,8 +45,8 @@ main(int argc, const char *argv[]) driver_return_code_t ret; driver_id_t driver_id = DRIVER_DEVICE; char *psz_drive = NULL; - - if (argc > 1) + + if (argc > 1) psz_drive = strdup(argv[1]); if (!psz_drive) { @@ -70,7 +68,7 @@ main(int argc, const char *argv[]) printf("Eject of CD-ROM drive %s failed.\n", psz_drive); break; } - + if (DRIVER_OP_SUCCESS == cdio_close_tray(psz_drive, &driver_id)) { printf("Closed tray of CD-ROM drive %s.\n", psz_drive); } else { @@ -93,7 +91,7 @@ main(int argc, const char *argv[]) driver_id = DRIVER_DEVICE; if (DRIVER_OP_SUCCESS == cdio_close_tray(NULL, &driver_id)) { - printf("Closed tray of CD-ROM drive for default disc driver:\n\t%s\n", + printf("Closed tray of CD-ROM drive for default disc driver:\n\t%s\n", cdio_driver_describe(driver_id)); } else { printf("Closing tray of CD-ROM drive failed for default " diff --git a/lib/driver/device.c b/lib/driver/device.c index 12dc9153..1f6b2988 100644 --- a/lib/driver/device.c +++ b/lib/driver/device.c @@ -458,7 +458,10 @@ cdio_eject_media_drive (const char *psz_drive) { CdIo_t *p_cdio = cdio_open (psz_drive, DRIVER_DEVICE); if (p_cdio) { - return cdio_eject_media(&p_cdio); + driver_return_code_t rc; + rc = cdio_eject_media(&p_cdio); + cdio_destroy(p_cdio); + return rc; } else { return DRIVER_OP_UNINIT; } -- 2.17.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor