summaryrefslogtreecommitdiff
path: root/src/interface.c
diff options
context:
space:
mode:
authoratlaua <luchsmail-gh@yahoo.com>2011-11-03 18:25:49 (GMT)
committer atlaua <luchsmail-gh@yahoo.com>2011-11-03 18:25:49 (GMT)
commitae26ecaf8d79687c9f8bf683706b009f1c55e812 (patch)
treefb9575c927bc67d82df5a5b591a6bac19d691281 /src/interface.c
parente084d91b55b9690cd89a60823c0be66929fc6d78 (diff)
downloadpowder-ae26ecaf8d79687c9f8bf683706b009f1c55e812.zip
powder-ae26ecaf8d79687c9f8bf683706b009f1c55e812.tar.gz
Prevented a malloc-related problem in interface.c from occuring.
Diffstat (limited to 'src/interface.c')
-rw-r--r--src/interface.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/interface.c b/src/interface.c
index 8311dd9..28a89de 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -3407,12 +3407,16 @@ int search_ui(pixel *vid_buf)
thumb_cache_add(img_id[i], thumb, thlen);
for (pos=0; pos<GRID_X*GRID_Y; pos++) {
if (search_dates[pos]) {
- char *id_d_temp = malloc(strlen(search_ids[pos])+strlen(search_dates[pos])+1);
+ char *id_d_temp = malloc(strlen(search_ids[pos])+strlen(search_dates[pos])+2);
+ if (id_d_temp == 0)
+ {
+ break;
+ }
strcpy(id_d_temp, search_ids[pos]);
strappend(id_d_temp, "_");
strappend(id_d_temp, search_dates[pos]);
//img_id[i] = mystrdup(id_d_temp);
- if (id_d_temp && !strcmp(id_d_temp, img_id[i])) {
+ if (!strcmp(id_d_temp, img_id[i])) {
break;
}
} else {