diff options
Diffstat (limited to 'daemon/LocalCapture.cpp')
-rw-r--r-- | daemon/LocalCapture.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/daemon/LocalCapture.cpp b/daemon/LocalCapture.cpp index 2dd3aff..baa3dd9 100644 --- a/daemon/LocalCapture.cpp +++ b/daemon/LocalCapture.cpp | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (C) ARM Limited 2010-2012. All rights reserved. | 2 | * Copyright (C) ARM Limited 2010-2013. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License version 2 as | 5 | * it under the terms of the GNU General Public License version 2 as |
@@ -30,7 +30,7 @@ void LocalCapture::createAPCDirectory(char* target_path) { | |||
30 | } | 30 | } |
31 | 31 | ||
32 | void LocalCapture::write(char* string) { | 32 | void LocalCapture::write(char* string) { |
33 | char* file = (char*)malloc(PATH_MAX); | 33 | char file[PATH_MAX]; |
34 | 34 | ||
35 | // Set full path | 35 | // Set full path |
36 | snprintf(file, PATH_MAX, "%s/session.xml", gSessionData->mAPCDir); | 36 | snprintf(file, PATH_MAX, "%s/session.xml", gSessionData->mAPCDir); |
@@ -40,13 +40,11 @@ void LocalCapture::write(char* string) { | |||
40 | logg->logError(__FILE__, __LINE__, "Error writing %s\nPlease verify the path.", file); | 40 | logg->logError(__FILE__, __LINE__, "Error writing %s\nPlease verify the path.", file); |
41 | handleException(); | 41 | handleException(); |
42 | } | 42 | } |
43 | |||
44 | free(file); | ||
45 | } | 43 | } |
46 | 44 | ||
47 | char* LocalCapture::createUniqueDirectory(const char* initialPath, const char* ending) { | 45 | char* LocalCapture::createUniqueDirectory(const char* initialPath, const char* ending) { |
48 | char* output; | 46 | char* output; |
49 | char* path = (char*)malloc(PATH_MAX); | 47 | char path[PATH_MAX]; |
50 | 48 | ||
51 | // Ensure the path is an absolute path, i.e. starts with a slash | 49 | // Ensure the path is an absolute path, i.e. starts with a slash |
52 | if (initialPath == 0 || strlen(initialPath) == 0) { | 50 | if (initialPath == 0 || strlen(initialPath) == 0) { |
@@ -70,7 +68,6 @@ char* LocalCapture::createUniqueDirectory(const char* initialPath, const char* e | |||
70 | 68 | ||
71 | output = strdup(path); | 69 | output = strdup(path); |
72 | 70 | ||
73 | free(path); | ||
74 | return output; | 71 | return output; |
75 | } | 72 | } |
76 | 73 | ||
@@ -107,7 +104,7 @@ int LocalCapture::removeDirAndAllContents(char* path) { | |||
107 | } | 104 | } |
108 | 105 | ||
109 | void LocalCapture::copyImages(ImageLinkList* ptr) { | 106 | void LocalCapture::copyImages(ImageLinkList* ptr) { |
110 | char* dstfilename = (char*)malloc(PATH_MAX); | 107 | char dstfilename[PATH_MAX]; |
111 | 108 | ||
112 | while (ptr) { | 109 | while (ptr) { |
113 | strncpy(dstfilename, gSessionData->mAPCDir, PATH_MAX); | 110 | strncpy(dstfilename, gSessionData->mAPCDir, PATH_MAX); |
@@ -124,5 +121,4 @@ void LocalCapture::copyImages(ImageLinkList* ptr) { | |||
124 | 121 | ||
125 | ptr = ptr->next; | 122 | ptr = ptr->next; |
126 | } | 123 | } |
127 | free(dstfilename); | ||
128 | } | 124 | } |