42089d587a5fb8fa89b590e208d548899dc0aaa0
[gentoo.git] /
1 From 2fb900e9e915f9ec6ac2f233255a0a527da164c2 Mon Sep 17 00:00:00 2001
2 From: "W. Trevor King" <wking@tremily.us>
3 Date: Sun, 23 Aug 2015 21:59:45 -0700
4 Subject: [PATCH 2/7] Free rawdevices after opening the connected device
5
6 Avoid leaking the raw-device memory.  For a similar example in the
7 libmtp source, see LIBMTP_Get_First_Device [1].
8
9 [1]: http://sourceforge.net/p/libmtp/code/ci/libmtp-1-1-9/tree/src/libmtp.c#l1690
10 ---
11  mtpfs.c | 1 +
12  1 file changed, 1 insertion(+)
13
14 diff --git a/mtpfs.c b/mtpfs.c
15 index 286cd24..bdd5f46 100644
16 --- a/mtpfs.c
17 +++ b/mtpfs.c
18 @@ -1390,6 +1390,7 @@ main (int argc, char *argv[])
19  
20      fprintf(stdout, "Attempting to connect device\n");
21      device = LIBMTP_Open_Raw_Device(&rawdevices[i]);
22 +    free (rawdevices);
23      if (device == NULL) {
24          fprintf(stderr, "Unable to open raw device %d\n", i);
25          return 1;
26 -- 
27 2.5.3
28