diff options
| author | Raghuram Subramani <raghus2247@gmail.com> | 2025-06-17 12:47:05 +0530 |
|---|---|---|
| committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-06-17 12:47:05 +0530 |
| commit | 9d7959bc4b2f70f1d22e296fca0c7a2cc834789a (patch) | |
| tree | b3973bdf15347e488150fd03c63958317127e32a | |
| parent | 8f09884fa5af21358fd34f9fd98b130a0318a696 (diff) | |
(file handling): fix memory leak
| -rw-r--r-- | msg.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -183,7 +183,8 @@ handle_file(const char *path) asprintf(&outpath, "%s/%s", OUTPUT, path); } - char *directory = dirname(strdup(outpath)); + char *temp_outpath = strdup(outpath); + char *directory = dirname(temp_outpath); char *next = calloc(strlen(directory) + 1, sizeof(char)); strcpy(next, ""); @@ -198,6 +199,9 @@ handle_file(const char *path) mkdir(next, 0700); } + free(next); + free(temp_outpath); + FILE *in = fopen(inpath, "r"); FILE *out = fopen(outpath, "w"); |
